Installation
Cargo
First you need to install the crate by adding this entry to your Cargo.toml dependencies list:
bevy_mod_scripting = { version = "0.9.0", features = ["lua54"]}
Choose the language features you wish enabled and add them to the features block.
Bevy Plugin
The next step is to add the BMS plugin to your application.
app.add_plugins(BMSPlugin);
You can modify each of the plugins contained within the plugin group using set(MySubPlugin).
Language Features
Each language supported by BMS can be switched-on via feature flag as below:
| Language | Feature Flag |
|---|---|
| Lua51 | lua51 |
| Lua52 | lua54 |
| Lua53 | lua53 |
| Lua54 | lua54 |
| Luajit | luajit |
| Luajit52 | luajit52 |
| Luau | luau |
| Rhai | rhai |
| Rune | rune |
Extra Features
In order to fit as many use cases as possible, BMS allows you to disable a lot of its functionality.
By default all of the useful features are enabled, but you may disable them if you wish if you are only needing BMS for script lifecycle management, and want to populate the bindings yourself.
| Feature | Description |
|---|---|
| core_functions | If enabled, will enable all core functions, i.e. bevy integrations which let you interact with Bevy via reflection |
| bevy_core_bindings | Enables bindings for the bevy_core module |
| bevy_ecs_bindings | Enables bindings for the bevy_ecs module |
| bevy_hierarchy_bindings | Enables bindings for the bevy_hierarchy module |
| bevy_input_bindings | Enables bindings for the bevy_input module |
| bevy_math_bindings | Enables bindings for the bevy_math module |
| bevy_reflect_bindings | Enables bindings for the bevy_reflect module |
| bevy_time_bindings | Enables bindings for the bevy_time module |
| bevy_transform_bindings | Enables bindings for the bevy_transform module |
| mlua_async | Enables mlua/async |
| mlua_serialize | Enables mlua/serialize |
| mlua_macros | Enables mlua/macros |
| unsafe_lua_modules | Allows loading unsafe modules via require in lua |
Managing Scripts
Scripts live in the standard Bevy assets directory. Loading a script means obtaining its byte representation and associated language.
Evaluating a script means:
- parsing the script body,
- and creating or updating the resources which store script state.
Loading
Scripts can be loaded into memory via the AssetServer.
let handle = asset_server.load::<ScriptAsset>("my_script.lua");
Or scripts can be created in memory.
let mut script = ScriptAsset::from("x = 0".into());
script.language = Language::Lua;
let handle = script_assets.add(script);
This will not evaluate any code yet.
Evaluating
A script does not participate in any callbacks until it is evaluated, to evaluate a script you must first attach it to an entity, or to a static script entry.
To evaluate a script, add it to a ScriptComponent or to StaticScripts.
Load File via AssetServer
#![allow(unused)] fn main() { extern crate bevy; extern crate bevy_mod_scripting; use bevy::prelude::*; use bevy_mod_scripting::prelude::*; fn load_script(asset_server: Res<AssetServer>, mut commands: Commands) { let handle = asset_server.load::<ScriptAsset>("my_script.lua"); commands.spawn(ScriptComponent(vec![handle])); } }
Create ScriptAsset and Add It
#![allow(unused)] fn main() { extern crate bevy; extern crate bevy_mod_scripting; use bevy::{asset::Assets, prelude::*}; use bevy_mod_scripting::prelude::*; fn add_script(mut script_assets: ResMut<Assets<ScriptAsset>>, mut commands: Commands) { let content: String = "x = 0".into(); let mut script = ScriptAsset::from(content); script.language = Language::Lua; let handle = script_assets.add(script); commands.spawn(ScriptComponent(vec![handle])); } }
Unloading
When you no longer need a script asset you can freely unload it, but the script attachment will persist.
In order to trigger the on_script_unloaded etc. callbacks, you need to remove the script from the ScriptComponent or StaticScripts.
When that happens a corresponding ScriptEvent::Detached will be dispatched, and then handled by a DeleteScript command. Once the last script in a context is removed, the context itself will also be removed.
Hot-loading scripts
To enable hot-loading of assets, you need to enable the necessary Bevy features as normal see the bevy cheatbook for instructions.
Assuming that hot-reloading is enabled for your app, any changes to script assets will automatically be picked up and the scripts re-loaded.
File Extensions
Normally the set of supported extensions is pre-decided by each language plugin.
I.e. Lua supports ".lua" extensions and Rhai supports ".rhai" extensions.
Scripts are mapped to the corresponding language plugin based on these and so it is important to use them correctly.
If you would like to add more extensions, you need to populate them via app.add_supported_script_extensions.
app.add_supported_script_extensions(&[".pua"], Language::Lua);
Advanced
Normally not necessary but knowing these exist could be useful for more advanced use cases.
Manually (re)loading scripts
In order to manually re-load or load a script you can issue the CreateOrUpdateScript command:
use bevy::prelude::*;
use bevy_mod_scripting::prelude::*;
let create_or_update = CreateOrUpdateScript::<LuaScriptingPlugin>::new(script_handle)
.with_content("print(\"hello world from new script body\")");
commands.queue(create_or_update);
replace LuaScriptingPlugin with the scripting plugin you are using.
Manually Deleting scripts
In order to delete a previously loaded script, you will need to issue a DeleteScript command like so:
commands.queue(DeleteScript::<LuaScriptingPlugin>::new(script_handle));
Replace LuaScriptingPlugin with the scripting plugin you are using.
Loading/Unloading timeframe
Script asset changes are processed together with bevy asset systems, in the Last schedule.
These are converted to ScriptEvent's which are handled right after via the ScriptingSystemSet::ScriptingCommandDispatch system set.
Attaching Scripts
Once you have scripts discovered and loaded, you'll want to run them.
At the moment BMS supports three methods of making scripts runnable:
- Attaching them to entities via
ScriptComponent's - Adding static scripts
- Creating dynamic systems ⚗️ (see the script systems section)
And then sending script event's which trigger callbacks on the scripts.
Attaching scripts to entities
In order to attach a script and make it runnable simply add a ScriptComponent to an entity
commands.entity(my_entity).insert(ScriptComponent::new(vec![my_script_handle, another_script_handle]));
When this script is run the entity global will represent the entity the script is attached to. This allows you to interact with the entity in your script easilly.
Making static scripts runnable
Some scripts do not require attaching to an entity. You can run these scripts by loading them first as you would with any other script, then either adding them at app level via add_static_script or by issuing a AddStaticScript command like so:
commands.queue(AddStaticScript::new(my_script_handle));
The script will then be run as any other script but without being attached to any entity. and as such the entity global will always represent an invalid entity.
Note: Internally these scripts are attached to a dummy entity and as such you can think of them as being attached to an entity with an id of 0.
Running Scripts
Scripts can run logic either when loaded or when triggered by an event. For example the script:
print("hello from load time")
function on_event(arg1)
print("hello from event time")
print(arg1)
end
Will print "hello from load time" when the script is loaded, and "hello from event time" when the script receives an event targeting the on_event callback with a receiver list including this script or entity.
In order to trigger on_event you need to first define a label, then send an event containing the label:
#[derive(Reflect)]
pub struct MyReflectType;
// define the label, you can define as many as you like here
callback_labels!(OnEvent => "on_event");
// trigger the event
fn send_event(mut writer: EventWriter<ScriptCallbackEvent>, mut allocator: ResMut<AppReflectAllocator>) {
let allocator = allocator.write();
let my_reflect_payload = ReflectReference::new_allocated(MyReflectType, &mut allocator);
writer.send(ScriptCallbackEvent::new_for_all_scripts(
OnEvent,
vec![my_reflect_payload.into()],
));
}
Note the second argument is the payload we are sending with the event, in this case we are sending an arbitrary reflect type MyReflectType. This can be any type you like, as long as it implements Reflect.
Other variants of the ScriptValue enum are available for sending different types of data, such as ScriptValue::Integer for primtive, types.
Event Handlers
In order for the events you send to actually be picked up, you need to inject special systems into your application. These systems will listen for the events and trigger the appropriate callbacks on the scripts:
app.add_systems(Update, event_handler::<OnEvent, LuaScriptingPlugin>);
Note the system is parameterized by the label we defined earlier, and the scripting plugin we are using. You can add as many of these systems as you like.
The event handler will catch all events with the label OnEvent and trigger the on_event callback on all targeted scripts which have that callback defined.
In order to handle events in the same frame and not accidentally have events "spill over" into the next frame, you should make sure to order any systems which produce these events before the event handler systems.
Commands
You can also use manually issued RunScriptCallback commands to trigger script callbacks as well. These must be run from a exclusive system, or via a any other system but with limited access to the world (See the WithWorldGuard system param, which will allow you to create a WorldGuard and use it to run the commands)
Controlling Script Bindings
In this book we refer to anything accessible by a script, which allows it to communicate with your Rust code a binding (which in previous versions was more generically referred to as a script API).
The "binding" here being used as in: binding script code to rust code.
Namespaces
Namespaces are a way to group functions together, and are used to prevent naming conflicts. You can have multiple namespaces, and each namespace can have multiple functions.
Language implementations will also look for specific functions registered on your type first before looking at the generic ReflectReference namespace.
Dynamic Functions
Everything callable by scripts must first be registered in the dynamic function registry. Notably we do not make use of the normal bevy function registry to improve performance and usability. This means you cannot call just any function.
In order for a function to be callable by a script it must adhere to a few requirements:
- Each argument must implement
FromScript. - Each return type must implement
IntoScript. - Each argument must also implement
GetTypeDependencies - Each return type must also implement
GetTypeDependencies
The into/from requirements allow us to convert these types to ScriptValue's, and each supported scripting language can then marshall these into the script.
Note these types are implemented for primitives, but if you want to interact with one of your Reflect implementing types, you will need to use one of Ref<T>, Mut<T> or Val<T> wrappers in place of &T, &mut T and T respectively.
These wrappers enable us to safely interact with bevy, and claim any necessary mutex'es on Resources, Components or Allocations.
The GetTypeDependencies, trait is simply a local trait alias for GetTypeRegistration with less strict type requirements. It allows us to register all the types necessary for the function calls, so that you don't have to register anything manually. If your type implements GetTypeRegistration you should not face any issues on this front.
Registering Script Functions
Registering functions can be done via the NamespaceBuilder like below:
NamespaceBuilder::<ReflectReference>::new(&mut world)
.register(
"hello_world",
|s: String| {
println!(s)
},
);
NamespaceBuilder::<GlobalNamespace>::new_unregistered(&mut world)
.register(
"hello_world2",
|s: String| {
println!(s)
},
);
This will allow you to call this function within lua like so:
some_type:hello_world("hi from method!");
hello_world2("hi from global!");
Note the new_unregistered call instead of new, this is because GlobalNamespace is not a Reflect type, and the new call also automatically registers the type in the reflection registry.
Macros
The above is a bit tedious, so instead you can use the script_bindings macro, which applies to impl blocks like so:
#[script_bindings(name = "test_fn")]
impl TestStruct {
/// My docs !!
///
/// Arguments:
/// * `_self` - the first argument
/// * `arg1` - the second argument
/// Returns:
/// * `return` - nothing
fn test_fn(_self: Ref<TestStruct>, mut arg1: usize) {}
}
pub fn main() {
let mut app = App::new();
register_test_fn(app.world_mut())
}
Note the documentation will automatically be picked up and stored for the purposes of reflection and documentation generation, including argument/return type specific docs.
Context Arguments
Each script function call always receives an additional context argument: FunctionCallContext.
You can opt-in to receive this argument in your own function definitions by adding it as the first argument.
The context contains requests from the caller to your function, such as "I am calling you from a 1-indexed array system, please convert the index first", This argument is only relevant if you're targeting multiple languages.
It also allows you to retrieve the world via FunctionCallContext::world().
You can use this as follows:
NamespaceBuilder::<ReflectReference>::new(&mut world)
.register(
"hello_world",
|ctx: FunctionCallContext, s: String| {
let world = ctx.world()?;
let should_use_0_indexing = ctx.convert_to_0_indexed;
println!(should_use_0_indexing);
println!(s)
Ok(())
},
);
Generic Arguments
Sometimes you might want to be generic over the type of argument you're accepting, you can do so by accepting ScriptValue arguments like so:
NamespaceBuilder::<ReflectReference>::new(&mut world)
.register(
"is_integer",
|s: ScriptValue| {
match s {
ScriptValue::Integer(i) => true,
_ => false
}
},
);
You can treat return values similarly.
Fallible functions
Your script functions can return errors either by:
- Returning
Result<T: IntoScript, InteropError> - Returning
ScriptValueand manually creating theScriptValue::Error(into_interop_erorr.into())variant.
Reserved Functions
There are a few reserved functions that you can override by registering them on a specific type:
| Function Name | Description | Overridable? | Has Default Implementation? |
|---|---|---|---|
| get | a getter function, used for indexing into a type | ❌ | ✅ |
| set | a setter function, used for setting a value on a type | ❌ | ✅ |
| sub | a subtraction function, used for subtracting two values | ✅ | ❌ |
| add | an addition function, used for adding two values | ✅ | ❌ |
| mul | a multiplication function, used for multiplying two values | ✅ | ❌ |
| div | a division function, used for dividing two values | ✅ | ❌ |
| rem | a remainder function, used for getting the remainder of two values | ✅ | ❌ |
| neg | a negation function, used for negating a value | ✅ | ❌ |
| pow | a power function, used for raising a value to a power | ✅ | ❌ |
| eq | an equality function, used for checking if two values are equal | ✅ | ❌ |
| lt | a less than function, used for checking if a value is less than another | ✅ | ❌ |
| iter | an iterator function, used for iterating over a value | ❌ | ✅ |
| display_ref | a display function, used for displaying a reference to a value | ❌ | ✅ |
| display_value | a display function, used for displaying a mutable reference to a value | ❌ | ✅ |
In this context overridable indicates whether language implementations will look for a specific function on your type before looking at the generic ReflectReference namespace. You can still remove the existing registration for these functions on the ReflectReference namespace if you want to replace them with your own implementation.
Note the ReflectReference namespace is special, in that functions defined on it, act like a fallback and hence apply to ALL references.
Globals
By default, each type registered with the type registry, has the following set:
- a static reference in the global namespace, i.e.:
Vec3,Mat3 - an entry in the
typesglobal type cache, i.e.:types.Vec3,types.Mat3
You can filter the types included by customising the CoreScriptGlobalsPlugin
Modifying Script Contexts
You should be able to achieve what you need by registering script functions in most cases. However sometimes you might want to override the way contexts are loaded, or how the runtime is initialized.
This is possible using Context Initializers and Context Pre Handling Initializers as well as Runtime Initializers.
It is however always reccomened to use the dynamic script function registry whenever possible, as it is more flexible and easier to use. It also allows you to introspect available functions easier.
Context Initializers
For example, let's say you want to set a dynamic amount of globals in your script, depending on some setting in your app.
You could do this by customizing the scripting plugin:
let plugin = LuaScriptingPlugin::default().add_context_initializer(|_context_key: &ContextKey, context: &mut Lua| {
let globals = context.globals();
for i in 0..10 {
globals.set(i, i);
}
Ok(())
});
app.add_plugins(plugin)
The above will run every time the script is loaded or re-loaded and before it handles any callbacks.
Context Pre Handling Initializers
If you want to customize your context before every time it's about to handle events (and when it's loaded + reloaded), you can use Context Pre Handling Initializers:
#![allow(unused)] fn main() { use bevy::prelude::*; use bevy_mod_scripting::prelude::*; fn scripting_plugin(app: &mut App) { app.add_plugins(LuaScriptingPlugin::default() .add_context_pre_handling_initializer(|context_key: &ContextKey, entity: Entity, context: &mut Lua| { let globals = context.globals(); if let Some(script_id) = context_key.script_id.as_ref() { globals.set("script_name", script_id.to_owned()); } Ok(()) })); } }
Runtime Initializers
Some scripting languages, have the concept of a runtime. This is a global object which is shared between all contexts. You can customize this object using Runtime Initializers:
#![allow(unused)] fn main() { use bevy::prelude::*; use bevy_mod_scripting::prelude::*; fn scripting_plugin(app: &mut App) { app.add_plugin(SomeScriptingPlugin::default().add_runtime_initializer(|runtime: &mut Runtime| { runtime.set_max_stack_size(1000); Ok(()) })); } }
In the case of Lua, the runtime type is () i.e. This is because mlua does not have a separate runtime concept.
Accessing the World in Initializers
You can access the world in these initializers by using the thread local: ThreadWorldContainer:
#![allow(unused)] fn main() { use bevy::prelude::*; use bevy_mod_scripting::prelude::*; fn scripting_plugin(app: &mut App) { let plugin = LuaScriptingPlugin::default(); plugin.add_context_initializer(|_context_key: &ContextKey, context: &mut Lua| { let world = ThreadWorldContainer.try_get_world().unwrap(); world.with_resource::<MyResource>(|res| println!("My resource: {:?}", res)); Ok(()) }); app.add_plugins(plugin); } }
Contexts
Each script runs in a context. By default BMS will create an individual context, or sandbox, for each script-entity pair that is run. This means that each script-entity pair will have its own set of global variables and functions that are isolated from other scripts. However, sometimes this might not be desirable. If you are not worried about scripts interfering with each other, or if you want to easily share data between scripts, you can consider using a different context policy.
Context Policies
Shared Context
A shared context means that all scripts run in the same context; there is in fact only one context to run in. If the scripts interact heavily with each other, this may be what you want.
To enable a shared context, set the corresponding context policy on the scripting plugin:
app.add_plugins(LuaScriptingPlugin::default().set_context_policy(
ContextPolicy::shared(),
));```
## Per Script Context
A per script context provides each script with their own context. However, scripts may be attached to multiple entities, in which case a single script context is shared by multiple entities.
To enable per script contexts, insert the `ContextPolicy::per_script()` resource.
```rust,ignore
app.add_plugins(LuaScriptingPlugin::default().set_context_policy(
ContextPolicy::per_script(),
));```
## Per Entity Context
A per entity context provides each entity with their own context. The scripts attached to an entity via `ScriptComponent` all run in the same context.
To enable per entity contexts, insert the `ContextPolicy::per_entity()` resource.
```rust,ignore
app.add_plugins(LuaScriptingPlugin::default().set_context_policy(
ContextPolicy::per_entity(),
));```
## Per Entity and Script Context
A per entity-and-script context provides each entity-script pair with their own context. This is a maximally isolated way to run scripts.
To enable per entity-and-script contexts, insert the `ContextPolicy::per_entity_and_script()` resource.
```rust,ignore
app.add_plugins(LuaScriptingPlugin::default().set_context_policy(
ContextPolicy::per_entity_and_script(),
));
Custom Policies
Here is another way to write the per_script() policy.
let policy_a = ContextPolicy::per_script();
let policy_b = ContextPolicy { priorities: vec![ContextRule::Script, ContextRule::Shared] };
assert_eq!(policy_a, policy_b);
Reminding ourselves how ContextKey is defined,
pub struct ContextKey {
pub entity: Option<Entity>,
pub script: Option<Handle<ScriptAsset>>,
}
we read policy_b like this: if ContextKey has a script, return a ContextKey with only a script. Failing that ContextRule::Shared always returns an empty ContextKey.
One may also provide an entirely custom rule by implementing the ContextKeySelector trait.
Context Loading Settings
All context loading settings are stored in a separate resource per scripting plugin namely: ContextLoadingSettings<Plugin>.
The settings are as follows:
loader- the load and unload strategy for contexts. Each scripting plugin will have a load and unload function which is hooked up through herecontext_initializers- stores all context initializers for the plugincontext_pre_handling_initializers- stores all context pre-handling initializers for the plugin
More advanced applications might want to customize these settings to suit their needs.
Script Systems
It's possible within BMS to inject new systems from within scripts themselves.
Systems introduced by scripts can run in parallel to other systems, and can be freely inserted between any other system, including other script systems.
BMS also provides utilities for visualising schedules using dot graphs, allowing low-effort modding frameworks for game authors.
Schedules
Bevy doesn't support reflecting schedules, so BMS rolls it's own schedule registry resource: AppScheduleRegistry, which can be used to add any custom schedules you want to interact with. The default Bevy schedules will be pre-populated for you.
Once you've registered your schedule you will be able to interact with it in scripts like below:
local update_schedule = world.get_schedule_by_name("Update")
local systems = update:systems()
local system_with_name = update:get_system_by_name("my_system")
Inserting Systems
To insert a system you will need to use the system_builder global function like below:
local system = system_builder("my_system", script_id)
:exclusive()
:after(some_other_system)
:before(another_system)
This will let you call world.add_system like so:
world.add_system(update_schedule,system)
If your event handler running the script is running in a certain schedule, that schedule will be temporarilly removed by Bevy. Meaning you won't be able to modify it from within the script in-flight.
Parameters
The system builder allows script authors to parameterise systems, using resource and query functions.
The order in which those functions are called, will define the order in which arguments will be provided to the specified script callback.
For example:
system_builder("my_system")
:query(
world.query()
:component(ComponentA)
:component(ComponentB)
:with(ComponentC)
:without(ComponentD)
)
:resource(ResourceA)
will create a system which calls the specified callback my_system with 2 arguments:
- The
ScriptQueryResultfor the first query- With
componentsaccess to ComponentA and ComponentB
- With
- The
ReflectReferencetoResourceA
Exclusive systems
An exclusive system can be created using the exclusive function call on the system builder.
This allows the system to access everything as in a normal event handler.
Non-exclusive systems, will only be able to access the set of components and resources as parameterized when building the system. This is why we can run the system in parallel to other non-overlapping systems.
Exclusive systems on the other hand, cannot run in parallel.
Callback
The system injected will be similar to an event handler, however it will only trigger the specified script, and without any entity, in the first example you'd see the following lua callback:
function my_system()
print("I am a dynamic system")
end
get triggered every update.
Examples
In the future we hope to embedd live WASM code examples into the documentation, for now the best source of example scripts will be our regression test suite available in all supported languages in our github repository.
For rust examples see this folder.
Release Notes
This section contains migration guides and release notes relevant to the bevy_mod_scripting crate.
This used to live in the repository, so for older release notes or guides, refer to the GitHub repository
Migration Guide: 0.13 to 0.14-alpha or 0.14 to 0.15
The most important changes to be aware of in this release are:
-
BMS now uses
Handle<ScriptAsset>as its principle means of referring to scripts as opposed to theScriptIdthat was used previously. -
BMS exposes many more choices for deciding how scripts are associated with the contexts in which they run.
-
script_idis replaced withscript_assetwhich now has a type ofHandle<ScriptAsset>.
Handles
The use of handles for scripts is perhaps the biggest user-facing change. It makes BMS asset usage follow Bevy's conventions. It requires less configuration. It is more idiomatic.
ScriptComponent Change
In prior versions, ScriptComponent accepted a vector of ScriptIds, which was a type alias for Cow<'static, str>.
-pub struct ScriptComponent(pub Vec<Cow<'static, str>>);
+pub struct ScriptComponent(pub Vec<Handle<ScriptAsset>>);
Because ScriptComponent accepts handles, it is no longer necessary to store the handles somewhere to prevent the script from unloading. Nor is it necessary to configure an asset path to script id mapper.
ScriptComponent(vec![asset_server.load("foo.lua")])
It is still beneficial to retain script assets in memory, for certain features to work. For example,
script_asset will not be able to retrieve the asset path of the script if it's not retained.
ScriptId Change
The ScriptId has changed from being a string to being an asset ID.
-type ScriptId = Cow<'static, str>
+type ScriptId = AssetId<ScriptAsset>
No Evaluation on Load
In prior versions, BMS would immediately evaluate a ScriptAsset when it was loaded, and if multiple script assets were loaded, they would be evaluated in non-deterministic order. (See issue #426.) Script assets no longer evaluate immediately. Script assets are only evaluated when their handles are added to a ScriptComponent or they are added to StaticScripts.
In addition when a ScriptComponent loads its scripts, it loads them sequentially.
ScriptAssetSettings Removed
The ScriptAssetSettings has been removed. Let us address each of its fields in turn.
script_id_mapper
See AssetPathToScriptIdMapper section.
extension_to_language_map and supported_extensions
This is now represented by the LanguageExtensions resource, which can be configured directly during initialization
pub struct LanguageExtensions(HashMap<&'static str, Language>);
or by the ConfigureScriptAssetSettings trait:
app.add_supported_script_extensions(&["p8lua"], Language::Lua);
In addition one can configure the language of an asset when it is loaded:
asset_server.load_with_settings("hello.p8lua", |settings: &mut ScriptSettings| {
settings.language = Some(Language::Lua);
});
or when it is created:
let content = String::from("x = 0");
let mut script = ScriptAsset::from(content);
script.language = Language::Lua;
ScriptMetadata and ScriptMetadataStore Removed
These were present to associate the previous ScriptId with the asset ID and language.
That is no longer necessary as the ScriptAsset knows its own language.
pub struct ScriptAsset {
/// The body of the script
pub content: Box<[u8]>,
/// The language of the script
pub language: Language,
}
AssetPathToScriptIdMapper Removed
No mapper is necessary between a script and a script ID. If you have a script handle, you have its script ID
let handle: Handle<ScriptAsset> = ...;
let script_id: ScriptId = handle.id(); // ScriptId = AssetId<ScriptAsset>
and vice versa.
let script_id: ScriptId = ...;
let handle: Handle<ScriptAsset> = Handle::Weak(script_id);
Contexts
Choosing how scripts run is a big policy decision. Previously BMS had two options:
- Each script ran in its own context.
- All scripts ran in one context.
This was controlled by the enable_context_sharing() method on
ConfigureScriptPlugin. That function is now deprecated. Instead use the set_context_policy method:
app.add_plugins(LuaScriptingPlugin::default().set_context_policy(
ContextPolicy::shared(),
));
The reason for this change is there are many more choices than before, namely:
ContextPolicy::shared()ContextPolicy::per_script()ContextPolicy::per_entity()ContextPolicy::per_entity_and_script()
See Contexts for more information.
ContextKey Added
Previously BMS used a ScriptId and sometimes an Entity to refer to a
context. If there was no entity then Entity::from_raw(0) was used. Instead BMS
now uses this ContextKey to look up contexts.
pub struct ContextKey {
/// Entity if there is one.
pub entity: Option<Entity>,
/// Script ID if there is one.
pub script_id: Option<Handle<ScriptAsset>>
}
This change affects the parameters for the context_pre_handling_initializers
- context_pre_handling_initializers: vec![|script_id, entity, context| {
+ context_pre_handling_initializers: vec![|context_key, context| {
and context_initializers:
- context_initializers: vec![|script_id, context| {
+ context_initializers: vec![|context_key, context| {
Recipients Changes
The Recipients enum now looks like this:
#[derive(Clone, Debug)]
pub enum Recipients {
/// The event needs to be handled by all scripts, if multiple scripts share a context, the event will be sent once per script in the context.
AllScripts,
/// The event is to be handled by all unique contexts, i.e. if two scripts share the same context, the event will be sent only once per the context.
AllContexts,
/// The event is to be handled by a specific script-entity pair
ScriptEntity(ScriptId, Entity),
/// the event is to be handled by a specific static script
StaticScript(ScriptId),
}
This aligns with how scripts are associated with contexts better.
ScriptCallbackEvent changes
The language for recipients is now controlled through the language field of the ScriptCallbackEvent. This allows for more flexibility in how callbacks are handled, especially when multiple languages are involved.
If no language is specified, the callback will apply to all languages.
#[derive(Clone, Event, Debug)]
#[non_exhaustive]
pub struct ScriptCallbackEvent {
/// The label of the callback
pub label: CallbackLabel,
/// The recipients of the callback
pub recipients: Recipients,
/// The language of the callback, if unspecified will apply to all languages
+ pub language: Option<Language>
/// The arguments to the callback
pub args: Vec<ScriptValue>,
/// Whether the callback should emit a response event
pub trigger_response: bool,
}
Bindings Changes
ScriptId
script_id is replaced with script_asset which now has a type of Handle<ScriptAsset>. This means that you can no longer use a string to refer to a script, but rather you must use a handle.
Scripts can still access the asset path of the script using:
-- prints: "my_script.lua"
print(script_asset:asset_path())
ScriptAttachment
The concept of script attachments has been introduced to describe the idea of a script instance. Previously this was muddied due to the fact script ID's were the primary way to refer to scripts. Now the instance of a script and its mapping to a context is clearer.
This is reflected in a brand new set of bindings:
-- will create backing ScriptAttachment instances, that can be used in other bindings.
local entity_script = ScriptAttachment.new_entity_script(entity, script_asset)
local static_script = ScriptAttachment.new_static_script(script_asset)
System Builder
the system builder no longer accepts script id's as parameters. Instead it accepts script attachments
-system_builder("my_callback", "this_script_id.lua")
+system_builder("my_callback", ScriptAttachment.new_static_script(script_asset))
0.15.0 - Asset Handles and Context Policies
This release focuses on aligning bevy_mod_scripting with modern Bevy practices, most notably by switching to Handle<ScriptAsset> for script management. This change simplifies the API, removes boilerplate, and makes script handling more idiomatic.
Summary
Asset-First Workflow
Scripts are now treated as first-class Bevy assets. The old ScriptId (which was a string) has been replaced by AssetId<ScriptAsset>, and you'll primarily interact with scripts via Handle<ScriptAsset>.
// New way
let handle: Handle<ScriptAsset> = asset_server.load("my_script.lua");
commands.spawn(ScriptComponent(vec![handle]));
Scripts are now only evaluated when they are attached to a ScriptComponent or added to StaticScripts, which means you have more control over when and how scripts are executed.
Flexible Context Policies
You now have much finer control over how script contexts (i.e., the environment a script runs in) are created. The old enable_context_sharing() has been replaced with set_context_policy() which accepts a ContextPolicy:
ContextPolicy::shared(): All scripts run in one global contextContextPolicy::per_script(): Each script asset gets its own context (the old default.)ContextPolicy::per_entity(): Each entity with scripts gets its own context.ContextPolicy::per_entity_and_script(): A unique context for every script on every entity (the new default).
This means that each script is maximally isolated by default, but you can still opt for shared contexts if needed.
Other Changes
RecipientsEnum: TheRecipientsenum for events has been redesigned to align with the new context policies, offeringAllScriptsandAllContextsvariants, and removing some variants which don't fit the new model. If you need the old behaviour, you can simply query the ECS first before sending events.- API Cleanup: Several types and traits were removed or simplified, including
ScriptAssetSettings,AssetPathToScriptIdMapper, andScriptMetadataStore, as they are no longer needed with the new asset-based approach.
Migration Guide
This release contains significant breaking changes. Please refer to the migration guide for detailed instructions on updating your project.
Scripting Reference
This part of the book covers the user-facing API of the scripting languages supported by BMS. This will be where you will want to forward your script users to get started with scripting in BMS.
If you are a modder, welcome! 👋, apologies for the rust-centricity of this guide, we are working on it!
Globals
Scripts will have access to a few global variables in most callbacks:
world: a static reference to the world, with all sorts of functions availableentity: the entity the script is attached to, not available on load/unload callbacks, and in dynamic system callbacks.script_id: the ID of the current script
Constructing Arbitrary Types
When interfacing with bevy, we do this via reflection.
While the generated bindings do not cover constructors for every single type that bevy or other libraries provide, reflection allows us to construct some (not all types implement FromReflect) types from dynamic structs.
BMS exposes this ability to all script writers via the construct global function.
Structs
The following struct:
pub struct MyStruct {
pub my_field: String
}
can be constructed from lua like so:
local MyStruct = types.MyStruct
local concrete_my_struct = construct(MyStruct, {
my_field = "hello"
})
Tuple Structs
The following tuple struct:
pub struct MyTupleStruct(pub String);
can be constructed like so:
local MyTupleStruct = types.MyTupleStruct
local concrete_my_tuple_struct = construct(MyTupleStruct, {
_1 = "hello"
})
Enums
The following enum:
pub enum MyEnum {
VariantA {
field: String
},
VariantB
}
can be constructed like so:
local MyEnum = types.MyEnum
local variantA = construct(MyEnum, {
variant = "VariantA",
field = "hello"
})
local variantB = construct(MyEnum, {
variant = "VariantB"
})
When working with enums you can also figure out the variant at runtime using variant_name:
if my_enum:variant_name() == "VariantA" then
print(my_enum.field)
end
Core Bindings
Contents
This is an automatically generated file, you'll find links to the contents below
| Section | Contents |
|---|---|
Types | Describes all available binding types |
Global Functions | Documents all the global functions present in the bindings |
Globals | Documents all global variables present in the bindings |
Globals
Global Values
Global values that are accessible anywhere inside scripts. You should avoid naming conflicts with these and trying to overwrite or edit them.
Instances
Instances containing actual accessible values.
| Instance | Type |
|---|---|
types | HashMap<String, ScriptTypeRegistration | ScriptComponentRegistration | ScriptResourceRegistration> |
script_asset | Handle<ScriptAsset> |
world | World |
entity | Entity |
Static Instances
Static type references, existing for the purpose of typed static function calls.
| Instance | Type |
|---|---|
Annulus | Annulus |
FunctionInfo | FunctionInfo |
AlignItems | AlignItems |
WindowBackendScaleFactorChanged | WindowBackendScaleFactorChanged |
TextColor | TextColor |
AnimationTransitions | AnimationTransitions |
GamepadRumbleRequest | GamepadRumbleRequest |
AtomicU16 | AtomicU16 |
Cascade | Cascade |
ConeMeshBuilder | ConeMeshBuilder |
BackgroundColor | BackgroundColor |
KeyboardFocusLost | KeyboardFocusLost |
ComputedNode | ComputedNode |
PointerId | PointerId |
RegularPolygonMeshBuilder | RegularPolygonMeshBuilder |
SmolStr | SmolStr |
ClusterZConfig | ClusterZConfig |
ChromaticAberration | ChromaticAberration |
OnInsert | OnInsert |
U8Vec3 | U8Vec3 |
GizmoLineStyle | GizmoLineStyle |
DynamicComponent | DynamicComponent |
DQuat | DQuat |
U16Vec4 | U16Vec4 |
CursorLeft | CursorLeft |
Arc2d | Arc2d |
CustomCursorImage | CustomCursorImage |
CameraRenderGraph | CameraRenderGraph |
BloomCompositeMode | BloomCompositeMode |
NonZeroI16 | NonZeroI16 |
FileDragAndDrop | FileDragAndDrop |
Mat3 | Mat3 |
ThreadedAnimationGraphs | ThreadedAnimationGraphs |
Frustum | Frustum |
ColorGradingSection | ColorGradingSection |
bool | bool |
ComputedNodeTarget | ComputedNodeTarget |
BorderColor | BorderColor |
WindowPosition | WindowPosition |
GltfExtras | GltfExtras |
ImageNode | ImageNode |
SystemIdMarker | SystemIdMarker |
WindowCreated | WindowCreated |
AccumulatedMouseMotion | AccumulatedMouseMotion |
Label | Label |
FontSmoothing | FontSmoothing |
LightGizmoConfigGroup | LightGizmoConfigGroup |
SmaaPreset | SmaaPreset |
i16 | i16 |
PathBuf | PathBuf |
MinTrackSizingFunction | MinTrackSizingFunction |
TimedAnimationEvent | TimedAnimationEvent |
ThreadedAnimationGraph | ThreadedAnimationGraph |
WindowClosing | WindowClosing |
Isometry2d | Isometry2d |
Sensitivity | Sensitivity |
RayId | RayId |
ZIndex | ZIndex |
Entity | Entity |
Namespace | Namespace |
RemovedComponentEntity | RemovedComponentEntity |
f64 | f64 |
GizmoLineJoint | GizmoLineJoint |
BloomPrefilter | BloomPrefilter |
Text2d | Text2d |
TouchPhase | TouchPhase |
TorusMeshBuilder | TorusMeshBuilder |
OrderIndependentTransparencySettings | OrderIndependentTransparencySettings |
EulerRot | EulerRot |
Camera3dDepthTextureUsage | Camera3dDepthTextureUsage |
U64Vec2 | U64Vec2 |
I8Vec2 | I8Vec2 |
ContentSize | ContentSize |
u8 | u8 |
DirectionalLightShadowMap | DirectionalLightShadowMap |
Tetrahedron | Tetrahedron |
DistanceFog | DistanceFog |
Dir3A | Dir3A |
ImageRenderTarget | ImageRenderTarget |
Quat | Quat |
Plane2d | Plane2d |
I16Vec4 | I16Vec4 |
GamepadButtonChangedEvent | GamepadButtonChangedEvent |
DiGraph | DiGraph |
CompassOctant | CompassOctant |
Ime | Ime |
ParallaxMappingMethod | ParallaxMappingMethod |
Line2d | Line2d |
Sprite | Sprite |
DeferredPrepass | DeferredPrepass |
KeyCode | KeyCode |
TemporalJitter | TemporalJitter |
ViewVisibility | ViewVisibility |
TextEntity | TextEntity |
AspectRatio | AspectRatio |
Ellipse | Ellipse |
Color | Color |
PickingPlugin | PickingPlugin |
I64Vec4 | I64Vec4 |
WindowRef | WindowRef |
GlobalTransform | GlobalTransform |
Rectangle | Rectangle |
WindowLevel | WindowLevel |
ButtonSettings | ButtonSettings |
IVec4 | IVec4 |
ForwardDecal | ForwardDecal |
CalculatedClip | CalculatedClip |
RequestRedraw | RequestRedraw |
Line3d | Line3d |
ScreenSpaceReflections | ScreenSpaceReflections |
PrimaryWindow | PrimaryWindow |
U8Vec2 | U8Vec2 |
Triangle2dMeshBuilder | Triangle2dMeshBuilder |
BoxShadow | BoxShadow |
GizmoConfig | GizmoConfig |
U64Vec4 | U64Vec4 |
DynamicSceneRoot | DynamicSceneRoot |
SubCameraView | SubCameraView |
UVec3 | UVec3 |
DebandDither | DebandDither |
Screenshot | Screenshot |
OverflowClipMargin | OverflowClipMargin |
GlyphAtlasLocation | GlyphAtlasLocation |
FunctionReturnInfo | FunctionReturnInfo |
Image | Image |
Triangle3d | Triangle3d |
TextBounds | TextBounds |
UiScale | UiScale |
I8Vec3 | I8Vec3 |
Fixed | Fixed |
Vec2 | Vec2 |
Camera | Camera |
BoundingCircle | BoundingCircle |
Laba | Laba |
Capsule3dMeshBuilder | Capsule3dMeshBuilder |
DepthOfField | DepthOfField |
f32 | f32 |
BorderRect | BorderRect |
DAffine3 | DAffine3 |
i8 | i8 |
AnimationGraph | AnimationGraph |
OverflowAxis | OverflowAxis |
Range | Range |
NonZeroU32 | NonZeroU32 |
BoundingCircleCast | BoundingCircleCast |
Ray3d | Ray3d |
Indices | Indices |
AlignSelf | AlignSelf |
SliceScaleMode | SliceScaleMode |
u64 | u64 |
VideoMode | VideoMode |
AtomicUsize | AtomicUsize |
BVec3A | BVec3A |
VolumetricFog | VolumetricFog |
RenderAssetUsages | RenderAssetUsages |
Vec3A | Vec3A |
MouseButton | MouseButton |
RotationGesture | RotationGesture |
VisibilityClass | VisibilityClass |
GamepadConnection | GamepadConnection |
AnimationClip | AnimationClip |
ScriptAsset | ScriptAsset |
Xyza | Xyza |
EntityHashSet | EntityHashSet |
FlexDirection | FlexDirection |
CircularMeshUvMode | CircularMeshUvMode |
OnAdd | OnAdd |
ScreenSpaceAmbientOcclusionQualityLevel | ScreenSpaceAmbientOcclusionQualityLevel |
Text | Text |
ReflectReference | ReflectReference |
CapsuleUvProfile | CapsuleUvProfile |
CustomProjection | CustomProjection |
ReflectSystem | ReflectSystem |
Virtual | Virtual |
Mat4 | Mat4 |
InfinitePlane3d | InfinitePlane3d |
RawGamepadEvent | RawGamepadEvent |
Tonemapping | Tonemapping |
CursorIcon | CursorIcon |
OnDespawn | OnDespawn |
Affine2 | Affine2 |
AtomicU32 | AtomicU32 |
AnimationEvent | AnimationEvent |
JumpAt | JumpAt |
ComponentId | ComponentId |
IrradianceVolume | IrradianceVolume |
AtomicBool | AtomicBool |
Bloom | Bloom |
ManualTextureViewHandle | ManualTextureViewHandle |
NotShadowCaster | NotShadowCaster |
ClusterFarZMode | ClusterFarZMode |
Segment3d | Segment3d |
WindowClosed | WindowClosed |
Cow | Cow |
EnabledButtons | EnabledButtons |
GamepadConnectionEvent | GamepadConnectionEvent |
InternalWindowState | InternalWindowState |
RangeInclusive | RangeInclusive |
EnvironmentMapLight | EnvironmentMapLight |
VideoModeSelection | VideoModeSelection |
FogFalloff | FogFalloff |
Outline | Outline |
PointerLocation | PointerLocation |
GamepadRumbleIntensity | GamepadRumbleIntensity |
CylinderAnchor | CylinderAnchor |
U16Vec2 | U16Vec2 |
ChildOf | ChildOf |
u128 | u128 |
Skybox | Skybox |
CylinderMeshBuilder | CylinderMeshBuilder |
Camera3dDepthLoadOp | Camera3dDepthLoadOp |
JustifySelf | JustifySelf |
ScreenSpaceTransmissionQuality | ScreenSpaceTransmissionQuality |
Dir2 | Dir2 |
CircularSegment | CircularSegment |
BoxShadowSamples | BoxShadowSamples |
LinearRgba | LinearRgba |
TextLayoutInfo | TextLayoutInfo |
ImageNodeSize | ImageNodeSize |
TypeId | TypeId |
I16Vec2 | I16Vec2 |
URect | URect |
RectangleMeshBuilder | RectangleMeshBuilder |
VolumetricLight | VolumetricLight |
AnimationEventTarget | AnimationEventTarget |
Capsule2dMeshBuilder | Capsule2dMeshBuilder |
SphereMeshBuilder | SphereMeshBuilder |
I64Vec2 | I64Vec2 |
Children | Children |
i32 | i32 |
CursorOptions | CursorOptions |
AtomicI16 | AtomicI16 |
AnimationTargetId | AnimationTargetId |
MeshMorphWeights | MeshMorphWeights |
Projection | Projection |
DMat4 | DMat4 |
Gamepad | Gamepad |
Affine3 | Affine3 |
TimerMode | TimerMode |
Display | Display |
SceneRoot | SceneRoot |
VisibilityRange | VisibilityRange |
RenderLayers | RenderLayers |
U8Vec4 | U8Vec4 |
SyncToRenderWorld | SyncToRenderWorld |
TextShadow | TextShadow |
CubemapVisibleEntities | CubemapVisibleEntities |
PointerPress | PointerPress |
I8Vec4 | I8Vec4 |
AabbCast3d | AabbCast3d |
ConicalFrustumMeshBuilder | ConicalFrustumMeshBuilder |
LineBreak | LineBreak |
Real | Real |
HitData | HitData |
WindowCloseRequested | WindowCloseRequested |
ScrollPosition | ScrollPosition |
UvChannel | UvChannel |
RayCast3d | RayCast3d |
GizmoLineConfig | GizmoLineConfig |
OverflowClipBox | OverflowClipBox |
Aabb3d | Aabb3d |
Window | Window |
StandardMaterial | StandardMaterial |
InheritedVisibility | InheritedVisibility |
DirectionalLight | DirectionalLight |
ScreenSpaceAmbientOcclusion | ScreenSpaceAmbientOcclusion |
TextureAtlasLayout | TextureAtlasLayout |
Triangle3dMeshBuilder | Triangle3dMeshBuilder |
I16Vec3 | I16Vec3 |
Smaa | Smaa |
Oklcha | Oklcha |
ShadowStyle | ShadowStyle |
GridTrackRepetition | GridTrackRepetition |
Aabb2d | Aabb2d |
CompositeAlphaMode | CompositeAlphaMode |
GamepadSettings | GamepadSettings |
Camera3d | Camera3d |
Arc | Arc |
DVec3 | DVec3 |
ClearColorConfig | ClearColorConfig |
FocusPolicy | FocusPolicy |
Segment2d | Segment2d |
Hwba | Hwba |
DMat3 | DMat3 |
Identifier | Identifier |
RepeatedGridTrack | RepeatedGridTrack |
DynamicScriptFunctionMut | DynamicFunctionMut |
MotionVectorPrepass | MotionVectorPrepass |
ButtonAxisSettings | ButtonAxisSettings |
GltfMaterialExtras | GltfMaterialExtras |
PointLight | PointLight |
OrthographicProjection | OrthographicProjection |
SystemCursorIcon | SystemCursorIcon |
LightProbe | LightProbe |
U64Vec3 | U64Vec3 |
BVec4 | BVec4 |
Uuid | Uuid |
Mesh2d | Mesh2d |
ShaderStorageBuffer | ShaderStorageBuffer |
OpaqueRendererMethod | OpaqueRendererMethod |
GamepadButtonStateChangedEvent | GamepadButtonStateChangedEvent |
ClusteredDecal | ClusteredDecal |
GltfMaterialName | GltfMaterialName |
AabbCast2d | AabbCast2d |
ReflectableScheduleLabel | ReflectableScheduleLabel |
AnimationTarget | AnimationTarget |
GridTrack | GridTrack |
ClearColor | ClearColor |
Plane3d | Plane3d |
PointerInputPlugin | PointerInputPlugin |
Button | Button |
Capsule3d | Capsule3d |
WindowDestroyed | WindowDestroyed |
MouseWheel | MouseWheel |
JustifyText | JustifyText |
CircularSectorMeshBuilder | CircularSectorMeshBuilder |
BoundingSphereCast | BoundingSphereCast |
NativeKeyCode | NativeKeyCode |
DMat2 | DMat2 |
PositionType | PositionType |
IVec2 | IVec2 |
AabbGizmoConfigGroup | AabbGizmoConfigGroup |
ReflectSchedule | ReflectSchedule |
UiAntiAlias | UiAntiAlias |
DefaultQueryFilters | DefaultQueryFilters |
FloatOrd | FloatOrd |
Capsule2d | Capsule2d |
Anchor | Anchor |
ComponentTicks | ComponentTicks |
UiRect | UiRect |
NormalPrepass | NormalPrepass |
Torus | Torus |
NodeIndex | NodeIndex |
ScriptSystemBuilder | ScriptSystemBuilder |
Interval | Interval |
Hsla | Hsla |
AtomicU64 | AtomicU64 |
AtomicU8 | AtomicU8 |
CompassQuadrant | CompassQuadrant |
DepthPrepass | DepthPrepass |
IVec3 | IVec3 |
AlphaMode2d | AlphaMode2d |
SocketAddr | SocketAddr |
NativeKey | NativeKey |
TextLayout | TextLayout |
DVec2 | DVec2 |
Viewport | Viewport |
I64Vec3 | I64Vec3 |
AnimationPlayer | AnimationPlayer |
Cuboid | Cuboid |
WindowFocused | WindowFocused |
VisibleMeshEntities | VisibleMeshEntities |
Oklaba | Oklaba |
Vec4 | Vec4 |
ScriptAttachment | ScriptAttachment |
BVec3 | BVec3 |
WindowOccluded | WindowOccluded |
ScreenshotCaptured | ScreenshotCaptured |
RawGamepadAxisChangedEvent | RawGamepadAxisChangedEvent |
TextFont | TextFont |
MouseMotion | MouseMotion |
PointLightShadowMap | PointLightShadowMap |
TextNodeFlags | TextNodeFlags |
SpotLight | SpotLight |
Volume | Volume |
PinchGesture | PinchGesture |
Key | Key |
Cone | Cone |
CircularSegmentMeshBuilder | CircularSegmentMeshBuilder |
OnRemove | OnRemove |
Msaa | Msaa |
AtomicI8 | AtomicI8 |
Monitor | Monitor |
GamepadButton | GamepadButton |
TetrahedronMeshBuilder | TetrahedronMeshBuilder |
WindowResized | WindowResized |
BVec2 | BVec2 |
TextureAtlas | TextureAtlas |
PlaybackSettings | PlaybackSettings |
AtomicI32 | AtomicI32 |
WindowMode | WindowMode |
Dir3 | Dir3 |
Mesh3d | Mesh3d |
BoxSizing | BoxSizing |
FlexWrap | FlexWrap |
ResolvedBorderRadius | ResolvedBorderRadius |
PerspectiveProjection | PerspectiveProjection |
WindowThemeChanged | WindowThemeChanged |
Mat2 | Mat2 |
IRect | IRect |
GltfSceneExtras | GltfSceneExtras |
ContrastAdaptiveSharpening | ContrastAdaptiveSharpening |
CameraMainTextureUsages | CameraMainTextureUsages |
SphereKind | SphereKind |
AlphaMode | AlphaMode |
CubemapFrusta | CubemapFrusta |
ScalingMode | ScalingMode |
Exposure | Exposure |
SpritePickingCamera | SpritePickingCamera |
Transform | Transform |
i64 | i64 |
ScriptQueryBuilder | ScriptQueryBuilder |
UVec4 | UVec4 |
ButtonState | ButtonState |
Hsva | Hsva |
WindowMoved | WindowMoved |
RegularPolygon | RegularPolygon |
ScriptValue | ScriptValue |
CircleMeshBuilder | CircleMeshBuilder |
Lcha | Lcha |
CursorGrabMode | CursorGrabMode |
Duration | Duration |
AmbientLight | AmbientLight |
JustifyItems | JustifyItems |
AssetPath | AssetPath |
EllipseMeshBuilder | EllipseMeshBuilder |
GamepadAxisChangedEvent | GamepadAxisChangedEvent |
VisibleEntities | VisibleEntities |
SpatialListener | SpatialListener |
AnimationTransition | AnimationTransition |
MipBias | MipBias |
CascadesFrusta | CascadesFrusta |
RawGamepadButtonChangedEvent | RawGamepadButtonChangedEvent |
MorphWeights | MorphWeights |
Rect | Rect |
ScriptResourceRegistration | ScriptResourceRegistration |
Node | Node |
AxisSettings | AxisSettings |
Vec3 | Vec3 |
Overflow | Overflow |
AssetIndex | AssetIndex |
CascadeShadowConfig | CascadeShadowConfig |
GlobalVolume | GlobalVolume |
Fxaa | Fxaa |
Ray2d | Ray2d |
UiTargetCamera | UiTargetCamera |
ComputedTextBlock | ComputedTextBlock |
AtomicIsize | AtomicIsize |
TransformTreeChanged | TransformTreeChanged |
ScriptComponentRegistration | ScriptComponentRegistration |
AtomicI64 | AtomicI64 |
GlyphAtlasInfo | GlyphAtlasInfo |
CircularSector | CircularSector |
RayCast2d | RayCast2d |
Rot2 | Rot2 |
TextureSlicer | TextureSlicer |
Srgba | Srgba |
CustomCursor | CustomCursor |
DVec4 | DVec4 |
Visibility | Visibility |
Camera2d | Camera2d |
Instant | Instant |
CuboidMeshBuilder | CuboidMeshBuilder |
NonZeroU16 | NonZeroU16 |
ActiveAnimation | ActiveAnimation |
GizmoConfigStore | GizmoConfigStore |
SpritePickingMode | SpritePickingMode |
BoundingSphere | BoundingSphere |
GamepadAxis | GamepadAxis |
Mesh | Mesh |
ColorGradingGlobal | ColorGradingGlobal |
MonitorSelection | MonitorSelection |
isize | isize |
Cascades | Cascades |
FunctionCallContext | FunctionCallContext |
Isometry3d | Isometry3d |
Circle | Circle |
GridPlacement | GridPlacement |
FunctionArgInfo | FunctionArgInfo |
SpriteImageMode | SpriteImageMode |
i128 | i128 |
RangeFull | RangeFull |
LightGizmoColor | LightGizmoColor |
Pickable | Pickable |
OcclusionCulling | OcclusionCulling |
PointerInteraction | PointerInteraction |
GridAutoFlow | GridAutoFlow |
ScriptTypeRegistration | ScriptTypeRegistration |
AnimationGraphHandle | AnimationGraphHandle |
RelativeCursorPosition | RelativeCursorPosition |
Disabled | Disabled |
U16Vec3 | U16Vec3 |
u32 | u32 |
ScriptQueryResult | ScriptQueryResult |
CascadesVisibleEntities | CascadesVisibleEntities |
ColorGrading | ColorGrading |
Timer | Timer |
RepeatAnimation | RepeatAnimation |
GltfMeshExtras | GltfMeshExtras |
usize | usize |
RenderTarget | RenderTarget |
WindowScaleFactorChanged | WindowScaleFactorChanged |
DAffine2 | DAffine2 |
AnnulusMeshBuilder | AnnulusMeshBuilder |
Interaction | Interaction |
ForceTouch | ForceTouch |
SpritePickingSettings | SpritePickingSettings |
InteropError | InteropError |
WindowResolution | WindowResolution |
Val | Val |
AccumulatedMouseScroll | AccumulatedMouseScroll |
WindowEvent | WindowEvent |
UiPickingSettings | UiPickingSettings |
LineHeight | LineHeight |
ConicalFrustum | ConicalFrustum |
Sphere | Sphere |
NoFrustumCulling | NoFrustumCulling |
DepthOfFieldMode | DepthOfFieldMode |
Name | Name |
KeyboardInput | KeyboardInput |
AppLifecycle | AppLifecycle |
PositionedGlyph | PositionedGlyph |
MouseScrollUnit | MouseScrollUnit |
char | char |
TouchInput | TouchInput |
ShadowFilteringMethod | ShadowFilteringMethod |
EaseFunction | EaseFunction |
DefaultOpaqueRendererMethod | DefaultOpaqueRendererMethod |
ConeAnchor | ConeAnchor |
u16 | u16 |
GamepadEvent | GamepadEvent |
String | String |
Triangle2d | Triangle2d |
MouseButtonInput | MouseButtonInput |
SpatialScale | SpatialScale |
TextSpan | TextSpan |
MaxTrackSizingFunction | MaxTrackSizingFunction |
GamepadInput | GamepadInput |
AtmosphereSettings | AtmosphereSettings |
CursorMoved | CursorMoved |
UiPickingCamera | UiPickingCamera |
BorderRadius | BorderRadius |
BVec4A | BVec4A |
ColorMaterial | ColorMaterial |
Tick | Tick |
GlobalsUniform | GlobalsUniform |
OnReplace | OnReplace |
PlaybackMode | PlaybackMode |
RhombusMeshBuilder | RhombusMeshBuilder |
Affine3A | Affine3A |
Atmosphere | Atmosphere |
ClusterConfig | ClusterConfig |
DoubleTapGesture | DoubleTapGesture |
Stopwatch | Stopwatch |
AlignContent | AlignContent |
WindowTheme | WindowTheme |
PlaneMeshBuilder | PlaneMeshBuilder |
Mat3A | Mat3A |
SkinnedMesh | SkinnedMesh |
EntityHash | EntityHash |
PresentMode | PresentMode |
NotShadowReceiver | NotShadowReceiver |
UVec2 | UVec2 |
JustifyContent | JustifyContent |
CursorEntered | CursorEntered |
Aabb | Aabb |
PickingInteraction | PickingInteraction |
PanGesture | PanGesture |
DefaultSpatialScale | DefaultSpatialScale |
Rhombus | Rhombus |
NodeImageMode | NodeImageMode |
WindowResizeConstraints | WindowResizeConstraints |
Cylinder | Cylinder |
Functions
Non-Associated Functions
Global functions that are not associated with any type and callable from anywhere in the script.
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| construct | Attempts to construct the given type, given an arbitrary map of values. |
| system_builder | Creates a new script system builder, which can be used to add new systems to the world. |
construct
Attempts to construct the given type, given an arbitrary map of values.
Arguments
| Name | Type | Documentation |
|---|---|---|
| registration | ScriptTypeRegistration | ScriptComponentRegistration | ScriptResourceRegistration | The type to construct. |
| payload | HashMap<String, ScriptValue> | The values to use to construct the type. |
Returns
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The constructed type. |
system_builder
Creates a new script system builder, which can be used to add new systems to the world.
Arguments
| Name | Type | Documentation |
|---|---|---|
| callback | String | The function name in the script this system should call when run. |
| attachment | ScriptAttachment | The script attachment to use for the system. This is the attachment that will be used for the system's callback. |
Returns
| Name | Type | Documentation |
|---|---|---|
| builder | ScriptSystemBuilder | The system builder |
Types
Available Types
All registered reflect-able types which can be constructed and directly manipulated by scripts.
| Type | Summary |
|---|---|
World | The ECS world containing all Components, Resources and Systems. Main point of interaction with a Bev... |
ReflectReference | A reference to an arbitrary reflected instance. The reference can point to either the ECS, or to ... |
ScriptComponentRegistration | A reference to a component type's reflection registration. In general think of this as a handle t... |
ScriptQueryBuilder | The query builder is used to build ECS queries which retrieve spefific components filtered by speci... |
ScriptQueryResult | A result from a query. |
ScriptResourceRegistration | A reference to a resource type's reflection registration. In general think of this as a handle to... |
ScriptTypeRegistration | A reference to a type which is not a `Resource` or `Component`. In general think of this as a han... |
ScriptSystemBuilder | A builder for systems living in scripts |
ScriptAttachment | Specifies a unique attachment of a script. These attachments are mapped to [`ContextKey`]'s depending on the context policy used. |
ReflectSchedule | A reflectable schedule. |
ReflectSystem | A reflectable system. |
Handle<ScriptAsset> | A handle to a specific [`Asset`] of type `A`. Handles act as abstract "references" to assets, whose data are stored in the [`Assets`](crate::prelude::Assets)... |
ComponentId | A value which uniquely identifies the type of a [`Component`] or [`Resource`] within a [`World`]. Each time a new `Component` type is registered within a `World` using e.g. [`World::register_component`]... |
ComponentTicks | Records when a component or resource was added and when it was last mutably dereferenced (or added)... |
Tick | A value that tracks when a system ran relative to other systems. This is used to power change dete... |
Entity | Lightweight identifier of an [entity](crate::entity). The identifier is implemented using a [gene... |
EntityHash | A [`BuildHasher`] that results in a [`EntityHasher`]. |
EntityHashSet | A [`HashSet`] pre-configured to use [`EntityHash`] hashing. |
DefaultQueryFilters | Default query filters work by excluding entities with certain components from most queries. If a ... |
Disabled | A marker component for disabled entities. Semantically, this component is used to mark entities t... |
ChildOf | Stores the parent entity of this child entity with this component. This is a [`Relationship`] component, and creates the canonical "parent / child" hierarchy. This is the "source of truth" component, and it pairs with the [`Children`]... |
Children | Tracks which entities are children of this parent entity. A [`RelationshipTarget`] collection component that is populated with entities that "target" this entity with the [`ChildOf`]... |
Identifier | A unified identifier for all entity and similar IDs. Has the same size as a `u64` integer, but th... |
Name | Component used to identify an entity. Stores a hash for faster comparisons. The hash is eagerly r... |
RemovedComponentEntity | Wrapper around [`Entity`] for [`RemovedComponents`]. Internally, `RemovedComponents` uses these as... |
ButtonState | The current "press" state of an element |
AxisSettings | Settings for a [`GamepadAxis`]. It is used inside the [`GamepadSettings`] to define the sensitivi... |
ButtonAxisSettings | Settings for a [`GamepadButton`]. It is used inside the [`GamepadSettings`] to define the sensiti... |
ButtonSettings | Manages settings for gamepad buttons. It is used inside [`GamepadSettings`] to define the threshold for a [`GamepadButton`]... |
Gamepad | Stores a connected gamepad's metadata such as the name and its [`GamepadButton`] and [`GamepadAxis`... |
GamepadAxis | Represents gamepad input types that are mapped in the range [-1.0, 1.0]. ## Usage This is used to determine which axis has changed its value when receiving a gamepad axis event. It is also used in the [`Gamepad`]... |
GamepadAxisChangedEvent | [`GamepadAxis`] event triggered by an analog state change. |
GamepadButton | Represents gamepad input types that are mapped in the range [0.0, 1.0]. ## Usage This is used to determine which button has changed its value when receiving gamepad button events. It is also used in the [`Gamepad`]... |
GamepadButtonChangedEvent | [`GamepadButton`] event triggered by an analog state change. |
GamepadButtonStateChangedEvent | [`GamepadButton`] event triggered by a digital state change. |
GamepadConnection | The connection status of a gamepad. |
GamepadConnectionEvent | A Gamepad connection event. Created when a connection to a gamepad is established and when a gamep... |
GamepadEvent | A gamepad event. This event type is used over the [`GamepadConnectionEvent`], [`GamepadButtonChangedEvent`... |
GamepadInput | Encapsulation over [`GamepadAxis`] and [`GamepadButton`]. |
GamepadRumbleIntensity | The intensity at which a gamepad's force-feedback motors may rumble. |
GamepadRumbleRequest | An event that controls force-feedback rumbling of a [`Gamepad`] [`entity`](Entity). # Notes Doe... |
GamepadSettings | Gamepad settings component. ## Usage It is used to create a `bevy` component that stores the se... |
RawGamepadAxisChangedEvent | [`GamepadAxis`] changed event unfiltered by [`GamepadSettings`]. |
RawGamepadButtonChangedEvent | [`GamepadButton`] changed event unfiltered by [`GamepadSettings`]. |
RawGamepadEvent | A raw gamepad event. This event type is used over the [`GamepadConnectionEvent`], [`RawGamepadButtonChangedEvent`... |
DoubleTapGesture | Double tap gesture. ## Platform-specific - Only available on **`macOS`** and **`iOS`**. - On *... |
PanGesture | Pan gesture. ## Platform-specific - On **`iOS`**, must be enabled first |
PinchGesture | Two-finger pinch gesture, often used for magnifications. Positive delta values indicate magnifica... |
RotationGesture | Two-finger rotation gesture. Positive delta values indicate rotation counterclockwise and negati... |
Key | The logical key code of a [`KeyboardInput`]. ## Technical Its values map 1 to 1 to winit's Key. |
KeyCode | The key code of a [`KeyboardInput`]. ## Usage It is used as the generic `T` value of an [`ButtonInput`... |
KeyboardFocusLost | Gets generated from `bevy_winit::winit_runner` Used for clearing all cached states to avoid havin... |
KeyboardInput | A keyboard input event. This event is the translated version of the `WindowEvent::KeyboardInput` ... |
NativeKey | Contains the platform-native logical key identifier, known as keysym. Exactly what that means dif... |
NativeKeyCode | Contains the platform-native physical key identifier The exact values vary from platform to platf... |
AccumulatedMouseMotion | Tracks how much the mouse has moved every frame. This resource is reset to zero every frame. Th... |
AccumulatedMouseScroll | Tracks how much the mouse has scrolled every frame. This resource is reset to zero every frame. ... |
MouseButton | A button on a mouse device. ## Usage It is used as the generic `T` value of an [`ButtonInput`] to create a `bevy` resource. ## Updating The resource is updated inside of the [`mouse_button_input_system`]... |
MouseButtonInput | A mouse button input event. This event is the translated version of the `WindowEvent::MouseInput`... |
MouseMotion | An event reporting the change in physical position of a pointing device. This represents raw, unf... |
MouseScrollUnit | The scroll unit. Describes how a value of a [`MouseWheel`] event has to be interpreted. The value of the event can either be interpreted as the amount of lines or the amount of pixels to scroll. |
MouseWheel | A mouse wheel event. This event is the translated version of the `WindowEvent::MouseWheel` from t... |
ForceTouch | A force description of a [`Touch`] input. |
TouchInput | A touch input event. ## Logic Every time the user touches the screen, a new [`TouchPhase::Started`]... |
TouchPhase | A phase of a [`TouchInput`]. ## Usage It is used to describe the phase of the touch input that is currently active. This includes a phase that indicates that a touch input has started or ended, or that a finger has moved. There is also a canceled phase that indicates that the system canceled the tracking of the finger. |
AspectRatio | An `AspectRatio` is the ratio of width to height. |
Aabb2d | A 2D axis-aligned bounding box, or bounding rectangle |
BoundingCircle | A bounding circle |
Aabb3d | A 3D axis-aligned bounding box |
BoundingSphere | A bounding sphere |
AabbCast2d | An intersection test that casts an [`Aabb2d`] along a ray. |
BoundingCircleCast | An intersection test that casts a [`BoundingCircle`] along a ray. |
RayCast2d | A raycast intersection test for 2D bounding volumes |
AabbCast3d | An intersection test that casts an [`Aabb3d`] along a ray. |
BoundingSphereCast | An intersection test that casts a [`BoundingSphere`] along a ray. |
RayCast3d | A raycast intersection test for 3D bounding volumes |
CompassOctant | A compass enum with 8 directions. ```text N (North) ▲ NW │ NE ╲ │ ╱ W (West) ┼─────► E (East) ╱ │ ╲ SW │ SE ▼ S (South) `... |
CompassQuadrant | A compass enum with 4 directions. ```text N (North) ▲ │ │ W (West) ┼─────► E (East) │ │ ▼ S (South) `... |
EaseFunction | Curve functions over the [unit interval], commonly used for easing transitions. `EaseFunction` can be used on its own to interpolate between `0.0` and `1.0`. It can also be combined with [`EasingCurve`]... |
JumpAt | Configuration options for the [`EaseFunction::Steps`] curves. This closely replicates the [CSS ste... |
Interval | A nonempty closed interval, possibly unbounded in either direction. In other words, the interval ... |
Dir2 | A normalized vector pointing in a direction in 2D space |
Dir3 | A normalized vector pointing in a direction in 3D space |
Dir3A | A normalized SIMD vector pointing in a direction in 3D space. This type stores a 16 byte aligned [`Vec3A`]... |
FloatOrd | A wrapper for floats that implements [`Ord`], [`Eq`], and [`Hash`] traits. This is a work around for the fact that the IEEE 754-2008 standard, implemented by Rust's [`f32`]... |
Isometry2d | An isometry in two dimensions, representing a rotation followed by a translation. This can often b... |
Isometry3d | An isometry in three dimensions, representing a rotation followed by a translation. This can often... |
Annulus | A primitive shape formed by the region between two circles, also known as a ring. |
Arc2d | A primitive representing an arc between two points on a circle. An arc has no area. If you want ... |
Capsule2d | A 2D capsule primitive, also known as a stadium or pill shape. A two-dimensional capsule is defin... |
Circle | A circle primitive, representing the set of points some distance from the origin |
CircularSector | A primitive representing a circular sector: a pie slice of a circle. The segment is positioned so... |
CircularSegment | A primitive representing a circular segment: the area enclosed by the arc of a circle and its chor... |
Ellipse | An ellipse primitive, which is like a circle, but the width and height can be different |
Line2d | An infinite line going through the origin along a direction in 2D space. For a finite line: [`Segment2d`]... |
Plane2d | An unbounded plane in 2D space. It forms a separating surface through the origin, stretching infin... |
Rectangle | A rectangle primitive, which is like a square, except that the width and height can be different |
RegularPolygon | A polygon centered on the origin where all vertices lie on a circle, equally far apart. |
Rhombus | A rhombus primitive, also known as a diamond shape. A four sided polygon, centered on the origin, ... |
Segment2d | A line segment defined by two endpoints in 2D space. |
Triangle2d | A triangle in 2D space |
Capsule3d | A 3D capsule primitive centered on the origin A three-dimensional capsule is defined as a surface ... |
Cone | A cone primitive centered on the midpoint between the tip of the cone and the center of its base. ... |
ConicalFrustum | A conical frustum primitive. A conical frustum can be created by slicing off a section of a cone. |
Cuboid | A cuboid primitive, which is like a cube, except that the x, y, and z dimensions are not required ... |
Cylinder | A cylinder primitive centered on the origin |
InfinitePlane3d | An unbounded plane in 3D space. It forms a separating surface through the origin, stretching infin... |
Line3d | An infinite line going through the origin along a direction in 3D space. For a finite line: [`Segment3d`]... |
Plane3d | A bounded plane in 3D space. It forms a surface starting from the origin with a defined height and ... |
Segment3d | A line segment defined by two endpoints in 3D space. |
Sphere | A sphere primitive, representing the set of all points some distance from the origin |
Tetrahedron | A tetrahedron primitive. |
Torus | A torus primitive, often representing a ring or donut shape The set of points some distance from a... |
Triangle3d | A 3D triangle primitive. |
Ray2d | An infinite half-line starting at `origin` and going in `direction` in 2D space. |
Ray3d | An infinite half-line starting at `origin` and going in `direction` in 3D space. |
IRect | A rectangle defined by two opposite corners. The rectangle is axis aligned, and defined by its mi... |
Rect | A rectangle defined by two opposite corners. The rectangle is axis aligned, and defined by its mi... |
URect | A rectangle defined by two opposite corners. The rectangle is axis aligned, and defined by its mi... |
Rot2 | A counterclockwise 2D rotation. # Example ``` # use approx::assert_relative_eq; # use bevy_math::{Rot2, Vec2}; use std::f32::consts::PI; // Create rotations from radians or degrees let rotation1 = Rot2::radians(PI / 2.0); let rotation2 = Rot2::degrees(45.0); // Get the angle back as radians or degrees assert_eq!(rotation1.as_degrees(), 90.0); assert_eq!(rotation2.as_radians(), PI / 4.0); // "Add" rotations together using `*` #[cfg(feature = "approx")] assert_relative_eq!(rotation1 * rotation2, Rot2::degrees(135.0)); // Rotate vectors #[cfg(feature = "approx")] assert_... |
Instant | No Documentation 🚧 |
Fixed | The fixed timestep game clock following virtual time. A specialization of the [`Time`] structure. **For method documentation, see [`Time |
Real | Real time clock representing elapsed wall clock time. A specialization of the [`Time`] structure. **For method documentation, see [`Time |
Stopwatch | A Stopwatch is a struct that tracks elapsed time when started. Note that in order to advance the ... |
Timer | Tracks elapsed time. Enters the finished state once `duration` is reached. Non repeating timers w... |
TimerMode | Specifies [`Timer`] behavior. |
Virtual | The virtual game clock representing game time. A specialization of the [`Time`] structure. **For method documentation, see [`Time |
GlobalTransform | [`GlobalTransform`] is an affine transformation from entity-local coordinates to worldspace coordinates. You cannot directly mutate [`GlobalTransform`]... |
Transform | Describe the position of an entity. If the entity has a parent, the position is relative to its pa... |
TransformTreeChanged | An optimization for transform propagation. This ZST marker component uses change detection to mark... |
TypeId | No Documentation 🚧 |
SocketAddr | No Documentation 🚧 |
RangeFull | No Documentation 🚧 |
AtomicBool | No Documentation 🚧 |
AtomicI16 | No Documentation 🚧 |
AtomicI32 | No Documentation 🚧 |
AtomicI64 | No Documentation 🚧 |
AtomicI8 | No Documentation 🚧 |
AtomicIsize | No Documentation 🚧 |
AtomicU16 | No Documentation 🚧 |
AtomicU32 | No Documentation 🚧 |
AtomicU64 | No Documentation 🚧 |
AtomicU8 | No Documentation 🚧 |
AtomicUsize | No Documentation 🚧 |
Duration | No Documentation 🚧 |
Affine2 | No Documentation 🚧 |
Affine3A | No Documentation 🚧 |
BVec2 | No Documentation 🚧 |
BVec3 | No Documentation 🚧 |
BVec3A | No Documentation 🚧 |
BVec4 | No Documentation 🚧 |
BVec4A | No Documentation 🚧 |
DAffine2 | No Documentation 🚧 |
DAffine3 | No Documentation 🚧 |
DMat2 | No Documentation 🚧 |
DMat3 | No Documentation 🚧 |
DMat4 | No Documentation 🚧 |
DQuat | No Documentation 🚧 |
DVec2 | No Documentation 🚧 |
DVec3 | No Documentation 🚧 |
DVec4 | No Documentation 🚧 |
EulerRot | No Documentation 🚧 |
I16Vec2 | No Documentation 🚧 |
I16Vec3 | No Documentation 🚧 |
I16Vec4 | No Documentation 🚧 |
I64Vec2 | No Documentation 🚧 |
I64Vec3 | No Documentation 🚧 |
I64Vec4 | No Documentation 🚧 |
I8Vec2 | No Documentation 🚧 |
I8Vec3 | No Documentation 🚧 |
I8Vec4 | No Documentation 🚧 |
IVec2 | No Documentation 🚧 |
IVec3 | No Documentation 🚧 |
IVec4 | No Documentation 🚧 |
Mat2 | No Documentation 🚧 |
Mat3 | No Documentation 🚧 |
Mat3A | No Documentation 🚧 |
Mat4 | No Documentation 🚧 |
Quat | No Documentation 🚧 |
U16Vec2 | No Documentation 🚧 |
U16Vec3 | No Documentation 🚧 |
U16Vec4 | No Documentation 🚧 |
U64Vec2 | No Documentation 🚧 |
U64Vec3 | No Documentation 🚧 |
U64Vec4 | No Documentation 🚧 |
U8Vec2 | No Documentation 🚧 |
U8Vec3 | No Documentation 🚧 |
U8Vec4 | No Documentation 🚧 |
UVec2 | No Documentation 🚧 |
UVec3 | No Documentation 🚧 |
UVec4 | No Documentation 🚧 |
Vec2 | No Documentation 🚧 |
Vec3 | No Documentation 🚧 |
Vec3A | No Documentation 🚧 |
Vec4 | No Documentation 🚧 |
SmolStr | No Documentation 🚧 |
Uuid | No Documentation 🚧 |
DynamicFunctionMut | A dynamic mutable script function. |
FunctionCallContext | The caller context when calling a script function. Functions can choose to react to caller prefere... |
PathBuf | A heap allocated file path |
String | A heap allocated string |
ActiveAnimation | An animation that an [`AnimationPlayer`] is currently either playing or was playing, but is presently paused. A stopped animation is considered no longer active. |
AnimationClip | A list of [`VariableCurve`]s and the [`AnimationTargetId`]s to which they apply. Because animati... |
AnimationEvent | No Documentation 🚧 |
AnimationEventTarget | No Documentation 🚧 |
AnimationPlayer | Animation controls. Automatically added to any root animations of a scene when it is spawned. |
AnimationTarget | An entity that can be animated by an [`AnimationPlayer`]. These are frequently referred to as *bones* or *joints*, because they often refer to individually-animatable parts of an armature. Asset loaders for armatures are responsible for adding these as necessary. Typically, they're generated from hashed versions of the entire name path from the root of the armature to the bone. See the [`AnimationTargetId`]... |
AnimationTargetId | A unique [UUID] for an animation target (e.g. bone in a skinned mesh). The [`AnimationClip`] asse... |
RepeatAnimation | Repetition behavior of an animation. |
TimedAnimationEvent | No Documentation 🚧 |
AnimationGraph | A graph structure that describes how animation clips are to be blended together. Applications fr... |
AnimationGraphHandle | A [`Handle`] to the [`AnimationGraph`] to be used by the [`AnimationPlayer`](crate::AnimationPlayer) on the same entity. |
ThreadedAnimationGraph | An acceleration structure for an animation graph that allows Bevy to evaluate it quickly. This i... |
ThreadedAnimationGraphs | Acceleration structures for animation graphs that allows Bevy to evaluate them quickly. These ar... |
AnimationTransition | An animation that is being faded out as part of a transition |
AnimationTransitions | Manages fade-out of animation blend factors, allowing for smooth transitions between animations. ... |
AssetIndex | A generational runtime-only identifier for a specific [`Asset`] stored in [`Assets`]. This is optim... |
AssetPath | Represents a path to an asset in a "virtual filesystem". Asset paths consist of three main parts:... |
RenderAssetUsages | Defines where the asset will be used. If an asset is set to the `RENDER_WORLD` but not the `MAIN_WORLD`... |
DefaultSpatialScale | The default scale factor applied to the positions of audio sources and listeners for spatial audio... |
PlaybackMode | The way Bevy manages the sound playback. |
PlaybackSettings | Initial settings to be used when audio starts playing. If you would like to control the audio whi... |
SpatialListener | Settings for the listener for spatial audio sources. This must be accompanied by `Transform` and `GlobalTransform`... |
SpatialScale | A scale factor applied to the positions of audio sources and listeners for spatial audio. Defaul... |
GlobalVolume | Use this [`Resource`] to control the global volume of all audio. Note: Changing [`GlobalVolume`] ... |
Volume | A [`Volume`] represents an audio source's volume level. To create a new [`Volume`] from a linear ... |
Color | An enumerated type that can represent any of the color types in this crate. This is useful when y... |
Hsla | Color in Hue-Saturation-Lightness (HSL) color space with alpha. Further information on this color ... |
Hsva | Color in Hue-Saturation-Value (HSV) color space with alpha. Further information on this color mode... |
Hwba | Color in Hue-Whiteness-Blackness (HWB) color space with alpha. Further information on this color m... |
Laba | Color in LAB color space, with alpha |
Lcha | Color in LCH color space, with alpha |
LinearRgba | Linear RGB color with alpha. |
Oklaba | Color in Oklab color space, with alpha |
Oklcha | Color in Oklch color space, with alpha |
Srgba | Non-linear standard RGB with alpha. |
Xyza | [CIE 1931](https://en.wikipedia.org/wiki/CIE_1931_color_space) color space, also known as XYZ, with an alpha channel. |
Bloom | Applies a bloom effect to an HDR-enabled 2d or 3d camera. Bloom emulates an effect found in real ... |
BloomCompositeMode | No Documentation 🚧 |
BloomPrefilter | Applies a threshold filter to the input image to extract the brightest regions before blurring the... |
ContrastAdaptiveSharpening | Applies a contrast adaptive sharpening (CAS) filter to the camera. CAS is usually used in combina... |
Camera2d | A 2D camera component. Enables the 2D render graph for a [`Camera`]. |
Camera3d | A 3D camera component. Enables the main 3D render graph for a [`Camera`]. The camera coordinate space is right-handed X-right, Y-up, Z-back. This means "forward" is -Z. |
Camera3dDepthLoadOp | The depth clear operation to perform for the main 3d pass. |
Camera3dDepthTextureUsage | No Documentation 🚧 |
ScreenSpaceTransmissionQuality | The quality of the screen space transmission blur effect, applied to whatever's “behind” transm... |
DepthOfField | A component that enables a [depth of field] postprocessing effect when attached to a [`Camera3d`], ... |
DepthOfFieldMode | Controls the appearance of the effect. |
Fxaa | A component for enabling Fast Approximate Anti-Aliasing (FXAA) for a [`bevy_render::camera::Camera`]. |
Sensitivity | No Documentation 🚧 |
OrderIndependentTransparencySettings | Used to identify which camera will use OIT to render transparent meshes and to configure OIT. |
ChromaticAberration | Adds colored fringes to the edges of objects in the scene. [Chromatic aberration] simulates the effect when lenses fail to focus all colors of light toward a single point. It causes rainbow-colored streaks to appear, which are especially apparent on the edges of objects. Chromatic aberration is commonly used for collision effects, especially in horror games. Bevy's implementation is based on that of *Inside* ([Gjøl & Svendsen 2016]... |
DeferredPrepass | If added to a [`crate::prelude::Camera3d`] then deferred materials will be rendered to the deferred gbuffer texture and will be available to subsequent passes. Note the default deferred lighting plugin also requires `DepthPrepass` to work correctly. |
DepthPrepass | If added to a [`crate::prelude::Camera3d`] then depth values will be copied to a separate texture available to the main pass. |
MotionVectorPrepass | If added to a [`crate::prelude::Camera3d`] then screen space motion vectors will be copied to a separate texture available to the main pass. |
NormalPrepass | If added to a [`crate::prelude::Camera3d`] then vertex world normals will be copied to a separate texture available to the main pass. Normals will have normal map textures already applied. |
Skybox | Adds a skybox to a 3D camera, based on a cubemap texture. Note that this component does not (curr... |
Smaa | A component for enabling Subpixel Morphological Anti-Aliasing (SMAA) for a [`bevy_render::camera::Camera`]. |
SmaaPreset | A preset quality level for SMAA. Higher values are slower but result in a higher-quality image. ... |
DebandDither | Enables a debanding shader that applies dithering to mitigate color banding in the final image for ... |
Tonemapping | Optionally enables a tonemapping shader that attempts to map linear input stimulus into a perceptua... |
SystemIdMarker | Marker [`Component`](bevy_ecs::component::Component) for identifying [`SystemId`] [`Entity`]s. |
OnAdd | Trigger emitted when a component is inserted onto an entity that does not already have that compon... |
OnDespawn | Trigger emitted for each component on an entity when it is despawned. See [`crate::component::ComponentHooks::on_despawn`] for more information. |
OnInsert | Trigger emitted when a component is inserted, regardless of whether or not the entity already had ... |
OnRemove | Trigger emitted when a component is removed from an entity, and runs before the component is remov... |
OnReplace | Trigger emitted when a component is inserted onto an entity that already has that component. Runs ... |
AabbGizmoConfigGroup | The [`GizmoConfigGroup`] used for debug visualizations of [`Aabb`] components on entities |
GizmoConfig | A struct that stores configuration for gizmos. |
GizmoConfigStore | A [`Resource`] storing [`GizmoConfig`] and [`GizmoConfigGroup`] structs Use `app.init_gizmo_group:: |
GizmoLineConfig | A struct that stores configuration for gizmos. |
GizmoLineJoint | An enum configuring how line joints will be drawn. |
GizmoLineStyle | An enum used to configure the style of gizmo lines, similar to CSS line-style |
LightGizmoColor | Configures how a color is attributed to a light gizmo. |
LightGizmoConfigGroup | The [`GizmoConfigGroup`] used to configure the visualization of lights. |
GltfExtras | Additional untyped data that can be present on most glTF types at the primitive level. See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras)... |
GltfMaterialExtras | Additional untyped data that can be present on most glTF types at the material level. See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras)... |
GltfMaterialName | The material name of a glTF primitive. See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-material). |
GltfMeshExtras | Additional untyped data that can be present on most glTF types at the mesh level. See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras)... |
GltfSceneExtras | Additional untyped data that can be present on most glTF types at the scene level. See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras)... |
Image | No Documentation 🚧 |
TextureAtlas | An index into a [`TextureAtlasLayout`], which corresponds to a specific section of a texture. It stores a handle to [`TextureAtlasLayout`]... |
TextureAtlasLayout | Stores a map used to lookup the position of a texture in a [`TextureAtlas`]. This can be used to either use and look up a specific section of a texture, or animate frame-by-frame as a sprite sheet. Optionally it can store a mapping from sub texture handles to the related area index (see [`TextureAtlasBuilder`]... |
Affine3 | Reduced-size version of `glam::Affine3A` for use when storage has significant performance impact. ... |
Indices | An array of indices into the [`VertexAttributeValues`](super::VertexAttributeValues) for a mesh. It describes the order in which the vertex attributes should be joined into faces. |
Mesh | A 3D object made out of vertices representing triangles, lines, or points, with "attribute" values... |
MeshMorphWeights | Control a specific [`Mesh`] instance's [morph targets]. These control the weights of specific "mes... |
MorphWeights | Controls the [morph targets] for all child `Mesh3d` entities. In most cases, [`MorphWeights`] shoul... |
AnnulusMeshBuilder | A builder for creating a [`Mesh`] with an [`Annulus`] shape. |
Capsule2dMeshBuilder | A builder used for creating a [`Mesh`] with a [`Capsule2d`] shape. |
CircleMeshBuilder | A builder used for creating a [`Mesh`] with a [`Circle`] shape. |
CircularMeshUvMode | Specifies how to generate UV-mappings for the [`CircularSector`] and [`CircularSegment`] shapes. ... |
CircularSectorMeshBuilder | A builder used for creating a [`Mesh`] with a [`CircularSector`] shape. The resulting mesh will h... |
CircularSegmentMeshBuilder | A builder used for creating a [`Mesh`] with a [`CircularSegment`] shape. The resulting mesh will ... |
EllipseMeshBuilder | A builder used for creating a [`Mesh`] with an [`Ellipse`] shape. |
RectangleMeshBuilder | A builder used for creating a [`Mesh`] with a [`Rectangle`] shape. |
RegularPolygonMeshBuilder | A builder used for creating a [`Mesh`] with a [`RegularPolygon`] shape. |
RhombusMeshBuilder | A builder for creating a [`Mesh`] with an [`Rhombus`] shape. |
Triangle2dMeshBuilder | A builder used for creating a [`Mesh`] with a [`Triangle2d`] shape. |
Capsule3dMeshBuilder | A builder used for creating a [`Mesh`] with a [`Capsule3d`] shape. |
CapsuleUvProfile | Manner in which UV coordinates are distributed vertically. |
ConeAnchor | Anchoring options for [`ConeMeshBuilder`] |
ConeMeshBuilder | A builder used for creating a [`Mesh`] with a [`Cone`] shape. |
ConicalFrustumMeshBuilder | A builder used for creating a [`Mesh`] with a [`ConicalFrustum`] shape. |
CuboidMeshBuilder | A builder used for creating a [`Mesh`] with a [`Cuboid`] shape. |
CylinderAnchor | Anchoring options for [`CylinderMeshBuilder`] |
CylinderMeshBuilder | A builder used for creating a [`Mesh`] with a [`Cylinder`] shape. |
PlaneMeshBuilder | A builder used for creating a [`Mesh`] with a [`Plane3d`] shape. |
SphereKind | A type of sphere mesh. |
SphereMeshBuilder | A builder used for creating a [`Mesh`] with an [`Sphere`] shape. |
TetrahedronMeshBuilder | A builder used for creating a [`Mesh`] with a [`Tetrahedron`] shape. |
TorusMeshBuilder | A builder used for creating a [`Mesh`] with a [`Torus`] shape. |
Triangle3dMeshBuilder | A builder used for creating a [`Mesh`] with a [`Triangle3d`] shape. |
SkinnedMesh | No Documentation 🚧 |
ScriptAsset | Represents a script loaded into memory as an asset |
Namespace | A namespace for functions |
DynamicComponent | A dynamic script component |
ScriptValue | An abstraction of values that can be passed to and from scripts. This allows us to re-use logic be... |
FunctionArgInfo | Information about a function argument. |
FunctionInfo | Information about a function. |
FunctionReturnInfo | Information about a function return value. |
InteropError | An error thrown when interoperating with scripting languages. |
Atmosphere | This component describes the atmosphere of a planet, and when added to a camera will enable atmosp... |
AtmosphereSettings | This component controls the resolution of the atmosphere LUTs, and how many samples are used when ... |
ClusterConfig | Configuration of the clustering strategy for clustered forward rendering |
ClusterFarZMode | Configure the far z-plane mode used for the furthest depth slice for clustered forward rendering |
ClusterZConfig | Configure the depth-slicing strategy for clustered forward rendering |
CascadesVisibleEntities | No Documentation 🚧 |
CubemapVisibleEntities | No Documentation 🚧 |
VisibleMeshEntities | Collection of mesh entities visible for 3D lighting. This component contains all mesh entities vi... |
ClusteredDecal | An object that projects a decal onto surfaces within its bounds. Conceptually, a clustered decal ... |
ForwardDecal | A decal that renders via a 1x1 transparent quad mesh, smoothly alpha-blending with the underlying ... |
DistanceFog | Configures the “classic” computer graphics [distance fog](https://en.wikipedia.org/wiki/Distance_fog) effect, in which objects appear progressively more covered in atmospheric haze the further away they are from the camera. Affects meshes rendered via the PBR [`StandardMaterial`](crate::StandardMaterial)... |
FogFalloff | Allows switching between different fog falloff modes, and configuring their parameters. ## Conven... |
Cascade | No Documentation 🚧 |
CascadeShadowConfig | Controls how cascaded shadow mapping works. Prefer using [`CascadeShadowConfigBuilder`] to construct an instance. ``` # use bevy_pbr::CascadeShadowConfig; # use bevy_pbr::CascadeShadowConfigBuilder; # use bevy_utils::default; # let config: CascadeShadowConfig = CascadeShadowConfigBuilder { maximum_distance: 100.0, ..default() }.into(); ``` |
Cascades | No Documentation 🚧 |
DirectionalLightShadowMap | Controls the resolution of [`DirectionalLight`] shadow maps. ``` # use bevy_app::prelude::*; # use bevy_pbr::DirectionalLightShadowMap; App::new() .insert_resource(DirectionalLightShadowMap { size: 4096 }); ``` |
NotShadowCaster | Add this component to make a [`Mesh3d`] not cast shadows. |
NotShadowReceiver | Add this component to make a [`Mesh3d`] not receive shadows. **Note:** If you're using diffuse transmission, setting [`NotShadowReceiver`]... |
PointLightShadowMap | Controls the resolution of [`PointLight`] shadow maps. ``` # use bevy_app::prelude::*; # use bevy_pbr::PointLightShadowMap; App::new() .insert_resource(PointLightShadowMap { size: 2048 }); ``` |
ShadowFilteringMethod | Add this component to a [`Camera3d`](bevy_core_pipeline::core_3d::Camera3d) to control how to anti-alias shadow edges. The different modes use different approaches to [Percentage Closer Filtering](https://developer.nvidia.com/gpugems/gpugems/part-ii-lighting-and-shadows/chapter-11-shadow-map-antialiasing). |
AmbientLight | An ambient light, which lights the entire scene equally. This resource is inserted by the [`PbrPlugin`]... |
DirectionalLight | A Directional light. Directional lights don't exist in reality but they are a good approximation... |
PointLight | A light that emits light in all directions from a central point. Real-world values for `intensity... |
SpotLight | A light that emits light in a given direction from a central point. Behaves like a point light in... |
LightProbe | A marker component for a light probe, which is a cuboid region that provides global illumination t... |
EnvironmentMapLight | A pair of cubemap textures that represent the surroundings of a specific area in space. See [`crate::environment_map`] for detailed information. |
IrradianceVolume | The component that defines an irradiance volume. See [`crate::irradiance_volume`] for detailed information. |
DefaultOpaqueRendererMethod | Default render method used for opaque materials. |
OpaqueRendererMethod | Render method used for opaque materials. The forward rendering main pass draws each mesh entity a... |
ParallaxMappingMethod | The [parallax mapping] method to use to compute depth based on the material's [`depth_map`]. Parallax Mapping uses a depth map texture to give the illusion of depth variation on a mesh surface that is geometrically flat. See the `parallax_... |
StandardMaterial | A material with "standard" properties used in PBR lighting. Standard property values with pictures... |
UvChannel | An enum to define which UV attribute to use for a texture. It is used for every texture in the [`StandardMaterial`]... |
ScreenSpaceAmbientOcclusion | Component to apply screen space ambient occlusion to a 3d camera. Screen space ambient occlusion ... |
ScreenSpaceAmbientOcclusionQualityLevel | No Documentation 🚧 |
ScreenSpaceReflections | Add this component to a camera to enable *screen-space reflections* (SSR). Screen-space reflectio... |
VolumetricFog | When placed on a [`bevy_core_pipeline::core_3d::Camera3d`], enables volumetric fog and volumetric lighting, also known as light shafts or god rays. |
VolumetricLight | Add this component to a [`DirectionalLight`](crate::DirectionalLight) with a shadow map (`shadows_enabled: true`) to make volumetric fog interact with it. This allows the light to generate light shafts/god rays. |
Pickable | An optional component that marks an entity as usable by a backend, and overrides default picking b... |
PickingPlugin | This plugin sets up the core picking infrastructure. It receives input events, and provides the sha... |
HitData | Holds data from a successful pointer hit test. See [`HitData::depth`] for important details. |
RayId | Identifies a ray constructed from some (pointer, camera) combination. A pointer can be over multip... |
PickingInteraction | A component that aggregates picking interaction state of this entity across all pointers. Unlike ... |
PointerInputPlugin | Adds mouse and touch inputs for picking pointers to your app. This is a default input plugin, that... |
PointerId | Identifies a unique pointer entity. `Mouse` and `Touch` pointers are automatically spawned. This ... |
PointerInteraction | Holds a list of entities this pointer is currently interacting with, sorted from nearest to farthe... |
PointerLocation | Component that tracks a pointer's current [`Location`]. |
PointerPress | Tracks the state of the pointer's buttons in response to [`PointerInput`] events. |
AlphaMode | Sets how a material's base color alpha channel is used for transparency. |
Camera | The defining [`Component`] for camera entities, storing information about how and what to render through this camera. The [`Camera`]... |
CameraMainTextureUsages | This component lets you control the [`TextureUsages`] field of the main texture generated for the camera |
CameraRenderGraph | Configures the [`RenderGraph`](crate::render_graph::RenderGraph) name assigned to be run for a given [`Camera`] entity. |
Exposure | How much energy a `Camera3d` absorbs from incoming light. https://en\.wikipedia\.org/wiki/Exposure\_\(photography\) |
ImageRenderTarget | A render target that renders to an [`Image`]. |
MipBias | Camera component specifying a mip bias to apply when sampling from material textures. Often used ... |
RenderTarget | The "target" that a [`Camera`] will render to. For example, this could be a [`Window`] swapchain o... |
SubCameraView | Settings to define a camera sub view. When [`Camera::sub_camera_view`] is `Some`, only the sub-section of the image defined by `size` and `offset` (relative to the `full_size` of the whole image) is projected to the cameras viewport. Take the example of the following multi-monitor setup: ```css ┌───┬───┐ │ A │ B │ ├───┼───┤ │ C │ D │ └───┴───┘ ``` If each monitor is 1920x1080, the whole image will have a resolution of 3840x2160. For each monitor we can use a single camera with a viewport of the same size as the monitor it corresponds to. To ensure that the image is cohesive, we can use a different sub view on each camera: - Camera A: `full_size` = 3840x2160, `size` = 1920x1080, `offset` = 0,0 - Camera B: `full_size` = 3840x2160, `size` = 1920x1080, `offset` = 1920,0 - Camera C: `full_size` = 3840x2160, `size` = 1920x1080, `offset` = 0,1080 - Camera D: `full_size` = 3840x2160, `size` = 1920x1080, `offset` = 1920,1080 However since only the ratio between the values is important, they could all be divided by 120 and still produce the same image. Camera D would for example have the following values: `full_size` = 32x18, `size` = 16x9, `offset` = 16,9 |
TemporalJitter | A subpixel offset to jitter a perspective camera's frustum by. Useful for temporal rendering tech... |
Viewport | Render viewport configuration for the [`Camera`] component. The viewport defines the area on the render target to which the camera renders its image. You can overlay multiple cameras in a single window using viewports to create effects like split screen, minimaps, and character viewers. |
ClearColor | A [`Resource`] that stores the color that is used to clear the screen between frames. This color appears as the "background" color for simple apps, when there are portions of the screen with nothing rendered. |
ClearColorConfig | For a camera, specifies the color used to clear the viewport before rendering. |
ManualTextureViewHandle | A unique id that corresponds to a specific [`ManualTextureView`] in the [`ManualTextureViews`] coll... |
CustomProjection | Holds a dynamic [`CameraProjection`] trait object. Use [`Projection::custom()`] to construct a cus... |
OrthographicProjection | Project a 3D space onto a 2D surface using parallel lines, i.e., unlike [`PerspectiveProjection`], the size of objects remains the same regardless of their distance to the camera. The volume contained in the projection is called the *view frustum*. Since the viewport is rectangular and projection lines are parallel, the view frustum takes the shape of a cuboid. Note that the scale of the projection and the apparent size of objects are inversely proportional. As the size of the projection increases, the size of objects decreases. # Examples Configure the orthographic projection to one world unit per 100 window pixels: ``` # use bevy_render::camera::{OrthographicProjection, Projection, ScalingMode}; let projection = Projection::Orthographic(OrthographicProjection { scaling_mode: ScalingMode::WindowSize, scale: 0.01, ..OrthographicProjection::default_2d() }); ``` |
PerspectiveProjection | A 3D camera projection in which distant objects appear smaller than close objects. |
Projection | Component that defines how to compute a [`Camera`]'s projection matrix. Common projections, like perspective and orthographic, are provided out of the box to handle the majority of use cases. Custom projections can be added using the [`CameraProjection`]... |
ScalingMode | Scaling mode for [`OrthographicProjection`]. The effect of these scaling modes are combined with the [`OrthographicProjection::scale`]... |
OcclusionCulling | Add this component to a view in order to enable experimental GPU occlusion culling. *Bevy's occlusion culling is currently marked as experimental.*... |
GlobalsUniform | Contains global values useful when writing shaders. Currently only contains values related to time... |
Mesh2d | A component for 2D meshes. Requires a [`MeshMaterial2d`] to be rendered, commonly using a [`ColorMaterial`... |
Mesh3d | A component for 3D meshes. Requires a [`MeshMaterial3d`] to be rendered, commonly using a [`StandardMaterial`... |
Aabb | An axis-aligned bounding box, defined by: - a center, - the distances from the center to each fac... |
CascadesFrusta | No Documentation 🚧 |
CubemapFrusta | No Documentation 🚧 |
Frustum | A region of 3D space defined by the intersection of 6 [`HalfSpace`]s. Frustums are typically an apex-truncated square pyramid (a pyramid without the top) or a cuboid. Half spaces are ordered left, right, top, bottom, near, far. The normal vectors of the half-spaces point towards the interior of the frustum. A frustum component is used on an entity with a [`Camera`]... |
ShaderStorageBuffer | A storage buffer that is prepared as a [`RenderAsset`] and uploaded to the GPU. |
SyncToRenderWorld | Marker component that indicates that its entity needs to be synchronized to the render world. Thi... |
ColorGrading | Configures filmic color grading parameters to adjust the image appearance. Color grading is appli... |
ColorGradingGlobal | Filmic color grading values applied to the image as a whole (as opposed to individual sections, li... |
ColorGradingSection | A section of color grading values that can be selectively applied to shadows, midtones, and highli... |
Msaa | Component for configuring the number of samples for [Multi-Sample Anti-Aliasing](https://en.wikipedia.org/wiki/Multisample_anti-aliasing) for a [`Camera`](crate::camera::Camera)... |
InheritedVisibility | Whether or not an entity is visible in the hierarchy. This will not be accurate until [`VisibilityPropagate`]... |
NoFrustumCulling | Use this component to opt-out of built-in frustum culling for entities, see [`Frustum`]. It can be used for example: - when a [`Mesh`]... |
ViewVisibility | Algorithmically-computed indication of whether an entity is visible and should be extracted for ren... |
Visibility | User indication of whether an entity is visible. Propagates down the entity hierarchy. If an enti... |
VisibilityClass | A bucket into which we group entities for the purposes of visibility. Bevy's various rendering su... |
VisibleEntities | Collection of entities visible from the current view. This component contains all entities which ... |
VisibilityRange | Specifies the range of distances that this entity must be from the camera in order to be rendered.... |
RenderLayers | Describes which rendering layers an entity belongs to. Cameras with this component will only rend... |
Screenshot | A component that signals to the renderer to capture a screenshot this frame. This component shoul... |
ScreenshotCaptured | No Documentation 🚧 |
DynamicSceneRoot | Adding this component will spawn the scene as a child of that entity. Once it's spawned, the entit... |
SceneRoot | Adding this component will spawn the scene as a child of that entity. Once it's spawned, the entit... |
ColorMaterial | A [2d material](Material2d) that renders [2d meshes](crate::Mesh2d) with a texture tinted by a unif... |
AlphaMode2d | Sets how a 2d material's base color alpha channel is used for transparency. Currently, this only w... |
SpritePickingCamera | An optional component that marks cameras that should be used in the [`SpritePickingPlugin`]. Only needed if [`SpritePickingSettings::require_markers`]... |
SpritePickingMode | How should the [`SpritePickingPlugin`] handle picking and how should it handle transparent pixels |
SpritePickingSettings | Runtime settings for the [`SpritePickingPlugin`]. |
Anchor | How a sprite is positioned relative to its [`Transform`]. It defaults to `Anchor::Center`. |
ScalingMode | Represents various modes for proportional scaling of a texture. Can be used in [`SpriteImageMode::Scale`]... |
Sprite | Describes a sprite to be rendered to a 2D camera |
SpriteImageMode | Controls how the image is altered when scaled. |
BorderRect | Defines the extents of the border of a rectangle. This struct is used to represent thickness or o... |
SliceScaleMode | Defines how a texture slice scales when resized |
TextureSlicer | Slices a texture using the **9-slicing** technique. This allows to reuse an image at various sizes ... |
ReflectableScheduleLabel | No Documentation 🚧 |
TextBounds | The maximum width and height of text. The text will wrap according to the specified size. Charact... |
GlyphAtlasInfo | Information about a glyph in an atlas. Rasterized glyphs are stored as rectangles in one or more... |
GlyphAtlasLocation | The location of a glyph in an atlas, and how it should be positioned when placed. Used in [`GlyphAtlasInfo`]... |
PositionedGlyph | A glyph of a font, typically representing a single character, positioned in screen space. Contain... |
TextLayoutInfo | Render information for a corresponding text block. Contains scaled glyphs and their size. Generat... |
Text2d | The top-level 2D text component. Adding `Text2d` to an entity will pull in required components fo... |
ComputedTextBlock | Computed information for a text block. See [`TextLayout`]. Automatically updated by 2d and UI text systems. |
FontSmoothing | Determines which antialiasing method to use when rendering text. By default, text is rendered with... |
JustifyText | Describes the horizontal alignment of multiple lines of text relative to each other. This only af... |
LineBreak | Determines how lines will be broken when preventing text from running out of bounds. |
LineHeight | Specifies the height of each line of text for `Text` and `Text2d` Default is 1.2x the font size |
TextColor | The color of the text for this section. |
TextEntity | A sub-entity of a [`ComputedTextBlock`]. Returned by [`ComputedTextBlock::entities`]. |
TextFont | `TextFont` determines the style of a text span within a [`ComputedTextBlock`], specifically the font face, the font size, and the color. |
TextLayout | Component with text format settings for a block of text. A block of text is composed of text span... |
TextSpan | A span of text in a tree of spans. `TextSpan` is only valid as a child of an entity with [`TextLayout`]... |
UiScale | The current scale of the UI. A multiplier to fixed-sized ui values. **Note:** This will only aff... |
FocusPolicy | Describes whether the node should block interactions with lower nodes |
Interaction | Describes what type of input interaction has occurred for a UI node. This is commonly queried wit... |
RelativeCursorPosition | A component storing the position of the mouse relative to the node, (0., 0.) being the top-left cor... |
UiRect | A type which is commonly used to define margins, paddings and borders. # Examples ## Margin A... |
Val | Represents the possible value types for layout properties. This enum allows specifying values for... |
ContentSize | A node with a `ContentSize` component is a node where its size is based on its content. |
UiPickingCamera | An optional component that marks cameras that should be used in the [`UiPickingPlugin`]. Only needed if [`UiPickingSettings::require_markers`]... |
UiPickingSettings | Runtime settings for the [`UiPickingPlugin`]. |
AlignContent | Used to control how items are distributed. - For Flexbox containers, controls alignment of lines i... |
AlignItems | Used to control how each individual item is aligned by default within the space they're given. - F... |
AlignSelf | Used to control how the specified item is aligned within the space it's given. - For Flexbox items... |
BackgroundColor | The background color of the node This serves as the "fill" color. |
BorderColor | The border color of the UI node. |
BorderRadius | Used to add rounded corners to a UI node. You can set a UI node to have uniformly rounded corners ... |
BoxShadow | List of shadows to draw for a [`Node`]. Draw order is determined implicitly from the vector of [`ShadowStyle`... |
BoxShadowSamples | Number of shadow samples. A larger value will result in higher quality shadows. Default is 4, val... |
BoxSizing | Which part of a Node's box length styles like width and height control See: <https://developer.mo... |
CalculatedClip | The calculated clip of the node |
ComputedNode | Provides the computed size and layout properties of the node. Fields in this struct are public bu... |
ComputedNodeTarget | Derived information about the camera target for this UI node. |
Display | Defines the layout model used by this node. Part of the [`Node`] component. |
FlexDirection | Defines how flexbox items are ordered within a flexbox |
FlexWrap | Defines if flexbox items appear on a single line or on multiple lines |
GridAutoFlow | Controls whether grid items are placed row-wise or column-wise as well as whether the sparse or den... |
GridPlacement | Represents the position of a grid item in a single axis. There are 3 fields which may be set: ... |
GridTrack | A [`GridTrack`] is a Row or Column of a CSS Grid. This struct specifies what size the track should be. See below for the different "track sizing functions" you can specify. |
GridTrackRepetition | How many times to repeat a repeated grid track <https://developer.mozilla.org/en-US/docs/Web/CSS/... |
JustifyContent | Used to control how items are distributed. - For Flexbox containers, controls alignment of items i... |
JustifyItems | Used to control how each individual item is aligned by default within the space they're given. - F... |
JustifySelf | Used to control how the specified item is aligned within the space it's given. - For Flexbox items... |
MaxTrackSizingFunction | No Documentation 🚧 |
MinTrackSizingFunction | No Documentation 🚧 |
Node | The base component for UI entities. It describes UI layout and style properties. When defining ne... |
Outline | The [`Outline`] component adds an outline outside the edge of a UI node. Outlines do not take up space in the layout. To add an [`Outline`]... |
Overflow | Whether to show or hide overflowing items |
OverflowAxis | Whether to show or hide overflowing items |
OverflowClipBox | Used to determine the bounds of the visible area when a UI node is clipped. |
OverflowClipMargin | The bounds of the visible area when a UI node is clipped. |
PositionType | The strategy used to position this node |
RepeatedGridTrack | Represents a *possibly* repeated [`GridTrack`]. The repetition parameter can either be: - The integer `1`, in which case the track is non-repeated. - a `u16` count to repeat the track N times. - A `GridTrackRepetition::AutoFit` or `GridTrackRepetition::AutoFill`. Note: that in the common case you want a non-repeating track (repetition count 1), you may use the constructor methods on [`GridTrack`]... |
ResolvedBorderRadius | Represents the resolved border radius values for a UI node. The values are in physical pixels. |
ScrollPosition | The scroll position of the node. Updating the values of `ScrollPosition` will reposition the chil... |
ShadowStyle | No Documentation 🚧 |
TextShadow | Adds a shadow behind text |
UiAntiAlias | Marker for controlling whether Ui is rendered with or without anti-aliasing in a camera. By defaul... |
UiTargetCamera | Indicates that this root [`Node`] entity should be rendered to a specific camera. UI then will be laid out respecting the camera's viewport and scale factor, and rendered to this camera's [`bevy_render::camera::RenderTarget`]... |
ZIndex | Indicates that this [`Node`] entity's front-to-back ordering is not controlled solely by its location in the UI hierarchy. A node with a higher z-index will appear on top of sibling nodes with a lower z-index. UI nodes that have the same z-index will appear according to the order in which they appear in the UI hierarchy. In such a case, the last node to be added to its parent will appear in front of its siblings. Nodes without this component will be treated as if they had a value of [`ZIndex(0)`]... |
Button | Marker struct for buttons |
ImageNode | A UI Node that renders an image. |
ImageNodeSize | The size of the image's texture This component is updated automatically by [`update_image_content_size_system`]... |
NodeImageMode | Controls how the image is altered to fit within the layout and how the layout algorithm determines ... |
Label | Marker struct for labels |
Text | The top-level UI text component. Adding [`Text`] to an entity will pull in required components for setting up a UI text node. The string in this component is the first 'text span' in a hierarchy of text spans that are collected into a [`ComputedTextBlock`]... |
TextNodeFlags | UI text system flags. Used internally by [`measure_text_system`] and [`text_system`] to schedule text for processing. |
AppLifecycle | Application lifetime events |
CursorEntered | An event that is sent whenever the user's cursor enters a window. |
CursorLeft | An event that is sent whenever the user's cursor leaves a window. |
CursorMoved | An event reporting that the mouse cursor has moved inside a window. The event is sent only if the... |
FileDragAndDrop | Events related to files being dragged and dropped on a window. |
Ime | An Input Method Editor event. This event is the translated version of the `WindowEvent::Ime` from... |
RequestRedraw | An event that indicates all of the application's windows should be redrawn, even if their control ... |
WindowBackendScaleFactorChanged | An event that indicates a window's OS-reported scale factor has changed. |
WindowCloseRequested | An event that is sent whenever the operating systems requests that a window be closed. This will b... |
WindowClosed | An event that is sent whenever a window is closed. This will be sent when the window entity loses ... |
WindowClosing | An event that is sent whenever a window is closing. This will be sent when after a [`WindowCloseRequested`]... |
WindowCreated | An event that is sent whenever a new window is created. To create a new window, spawn an entity w... |
WindowDestroyed | An event that is sent whenever a window is destroyed by the underlying window system. Note that i... |
WindowEvent | Wraps all `bevy_window` and `bevy_input` events in a common enum. Read these events with `EventReader |
WindowFocused | An event that indicates a window has received or lost focus. |
WindowMoved | An event that is sent when a window is repositioned in physical pixels. |
WindowOccluded | The window has been occluded (completely hidden from view). This is different to window visibilit... |
WindowResized | A window event that is sent whenever a window's logical size has changed. |
WindowScaleFactorChanged | An event that indicates a window's scale factor has changed. |
WindowThemeChanged | An event sent when the system theme changes for a window. This event is only sent when the window... |
Monitor | Represents an available monitor as reported by the user's operating system, which can be used to q... |
VideoMode | Represents a video mode that a monitor supports |
SystemCursorIcon | The icon to display for a window. Examples of all of these cursors can be found [here](https://www.w3schools.com/cssref/playit.php?filename=playcss_cursor&preval=crosshair). This `enum` is simply a copy of a similar `enum` found in [`winit`](https://docs.rs/winit/latest/winit/window/enum.CursorIcon.html)... |
CompositeAlphaMode | Specifies how the alpha channel of the textures should be handled during compositing, for a [`Window`]... |
CursorGrabMode | Defines if and how the cursor is grabbed by a [`Window`]. ## Platform-specific - **`Windows`** doesn't support [`CursorGrabMode::Locked`]... |
CursorOptions | Cursor data for a [`Window`]. |
EnabledButtons | Specifies which [`Window`] control buttons should be enabled. ## Platform-specific **`iOS`**, **`Android`**, and the **`Web`** do not have window control buttons. On some **`Linux`** environments these values have no effect. |
InternalWindowState | Stores internal [`Window`] state that isn't directly accessible. |
MonitorSelection | References a screen monitor. Used when centering a [`Window`] on a monitor. |
PresentMode | Presentation mode for a [`Window`]. The presentation mode specifies when a frame is presented to the window. The [`Fifo`]... |
PrimaryWindow | Marker [`Component`] for the window considered the primary window. Currently this is assumed to only exist on 1 entity at a time. [`WindowPlugin`](crate::WindowPlugin)... |
VideoModeSelection | References an exclusive fullscreen video mode. Used when setting [`WindowMode::Fullscreen`] on a window. |
Window | The defining [`Component`] for window entities, storing information about how it should appear and behave. Each window corresponds to an entity, and is uniquely identified by the value of their [`Entity`]... |
WindowLevel | Specifies where a [`Window`] should appear relative to other overlapping windows (on top or under) . Levels are groups of windows with respect to their z-position. The relative ordering between windows in different window levels is fixed. The z-order of windows within the same window level may change dynamically on user interaction. ## Platform-specific - **iOS / Android / Web / Wayland:** Unsupported. |
WindowMode | Defines the way a [`Window`] is displayed. |
WindowPosition | Defines where a [`Window`] should be placed on the screen. |
WindowRef | Reference to a [`Window`], whether it be a direct link to a specific entity or a more vague defaulting choice. |
WindowResizeConstraints | The size limits on a [`Window`]. These values are measured in logical pixels (see [`WindowResolution`... |
WindowResolution | Controls the size of a [`Window`] ## Physical, logical and requested sizes There are three sizes associated with a window: - the physical size, which represents the actual height and width in physical pixels the window occupies on the monitor, - the logical size, which represents the size that should be used to scale elements inside the window, measured in logical pixels, - the requested size, measured in logical pixels, which is the value submitted to the API when creating the window, or requesting that it be resized. ## Scale factor The reason logical size and physical size are separated and can be different is to account for the cases where: - several monitors have different pixel densities, - the user has set up a pixel density preference in its operating system, - the Bevy `App` has specified a specific scale factor between both. The factor between physical size and logical size can be retrieved with [`WindowResolution::scale_factor`]... |
WindowTheme | The [`Window`] theme variant to use. |
CursorIcon | Insert into a window entity to set the cursor for that window. |
CustomCursor | Custom cursor image data. |
CustomCursorImage | A custom cursor created from an image. |
bool | A boolean value |
char | An 8-bit character |
NonZeroI16 | No Documentation 🚧 |
NonZeroU16 | No Documentation 🚧 |
NonZeroU32 | No Documentation 🚧 |
f32 | A 32-bit floating point number |
f64 | A 64-bit floating point number |
i128 | A signed 128-bit integer |
i16 | A signed 16-bit integer |
i32 | A signed 32-bit integer |
i64 | A signed 64-bit integer |
i8 | A signed 8-bit integer |
isize | A signed pointer-sized integer |
NodeIndex | No Documentation 🚧 |
u128 | An unsigned 128-bit integer |
u16 | An unsigned 16-bit integer |
u32 | An unsigned 32-bit integer |
u64 | An unsigned 64-bit integer |
u8 | An unsigned 8-bit integer |
usize | An unsigned pointer-sized integer |
Cow | No Documentation 🚧 |
Vec<String> | No Documentation 🚧 |
Vec<TimedAnimationEvent> | No Documentation 🚧 |
Vec<AnimationTransition> | No Documentation 🚧 |
Vec<Entity> | No Documentation 🚧 |
Vec<URect> | No Documentation 🚧 |
Vec<ScriptQueryResult> | No Documentation 🚧 |
Vec<ReflectReference> | No Documentation 🚧 |
Vec<FunctionArgInfo> | No Documentation 🚧 |
Vec<FunctionInfo> | No Documentation 🚧 |
Vec<Cascade> | No Documentation 🚧 |
Vec<ReflectSystem> | No Documentation 🚧 |
Vec<PositionedGlyph> | No Documentation 🚧 |
Vec<GridTrack> | No Documentation 🚧 |
Vec<RepeatedGridTrack> | No Documentation 🚧 |
Vec<ShadowStyle> | No Documentation 🚧 |
Vec<VideoMode> | No Documentation 🚧 |
Vec<f32> | No Documentation 🚧 |
Vec<NodeIndex> | No Documentation 🚧 |
Vec<u16> | No Documentation 🚧 |
Vec<u32> | No Documentation 🚧 |
Vec<u64> | No Documentation 🚧 |
Handle<Unknown> | A handle to a specific [`Asset`] of type `A`. Handles act as abstract "references" to assets, whose data are stored in the [`Assets`](crate::prelude::Assets)... |
Handle<AnimationClip> | A handle to a specific [`Asset`] of type `A`. Handles act as abstract "references" to assets, whose data are stored in the [`Assets`](crate::prelude::Assets)... |
Handle<AnimationGraph> | A handle to a specific [`Asset`] of type `A`. Handles act as abstract "references" to assets, whose data are stored in the [`Assets`](crate::prelude::Assets)... |
Handle<Image> | A handle to a specific [`Asset`] of type `A`. Handles act as abstract "references" to assets, whose data are stored in the [`Assets`](crate::prelude::Assets)... |
Handle<TextureAtlasLayout> | A handle to a specific [`Asset`] of type `A`. Handles act as abstract "references" to assets, whose data are stored in the [`Assets`](crate::prelude::Assets)... |
Handle<Mesh> | A handle to a specific [`Asset`] of type `A`. Handles act as abstract "references" to assets, whose data are stored in the [`Assets`](crate::prelude::Assets)... |
Handle<StandardMaterial> | A handle to a specific [`Asset`] of type `A`. Handles act as abstract "references" to assets, whose data are stored in the [`Assets`](crate::prelude::Assets)... |
Handle<ShaderStorageBuffer> | A handle to a specific [`Asset`] of type `A`. Handles act as abstract "references" to assets, whose data are stored in the [`Assets`](crate::prelude::Assets)... |
Handle<ColorMaterial> | A handle to a specific [`Asset`] of type `A`. Handles act as abstract "references" to assets, whose data are stored in the [`Assets`](crate::prelude::Assets)... |
AssetId<Unknown> | A unique runtime-only identifier for an [`Asset`]. This is cheap to [`Copy`]/[`Clone`] and is not directly tied to the lifetime of the Asset. This means it _can_ point to an [`Asset`]... |
AssetId<AnimationClip> | A unique runtime-only identifier for an [`Asset`]. This is cheap to [`Copy`]/[`Clone`] and is not directly tied to the lifetime of the Asset. This means it _can_ point to an [`Asset`]... |
AssetId<AnimationGraph> | A unique runtime-only identifier for an [`Asset`]. This is cheap to [`Copy`]/[`Clone`] and is not directly tied to the lifetime of the Asset. This means it _can_ point to an [`Asset`]... |
AssetId<Image> | A unique runtime-only identifier for an [`Asset`]. This is cheap to [`Copy`]/[`Clone`] and is not directly tied to the lifetime of the Asset. This means it _can_ point to an [`Asset`]... |
AssetId<TextureAtlasLayout> | A unique runtime-only identifier for an [`Asset`]. This is cheap to [`Copy`]/[`Clone`] and is not directly tied to the lifetime of the Asset. This means it _can_ point to an [`Asset`]... |
AssetId<Mesh> | A unique runtime-only identifier for an [`Asset`]. This is cheap to [`Copy`]/[`Clone`] and is not directly tied to the lifetime of the Asset. This means it _can_ point to an [`Asset`]... |
AssetId<ScriptAsset> | A unique runtime-only identifier for an [`Asset`]. This is cheap to [`Copy`]/[`Clone`] and is not directly tied to the lifetime of the Asset. This means it _can_ point to an [`Asset`]... |
AssetId<StandardMaterial> | A unique runtime-only identifier for an [`Asset`]. This is cheap to [`Copy`]/[`Clone`] and is not directly tied to the lifetime of the Asset. This means it _can_ point to an [`Asset`]... |
AssetId<ShaderStorageBuffer> | A unique runtime-only identifier for an [`Asset`]. This is cheap to [`Copy`]/[`Clone`] and is not directly tied to the lifetime of the Asset. This means it _can_ point to an [`Asset`]... |
AssetId<ColorMaterial> | A unique runtime-only identifier for an [`Asset`]. This is cheap to [`Copy`]/[`Clone`] and is not directly tied to the lifetime of the Asset. This means it _can_ point to an [`Asset`]... |
Axis<GamepadInput> | Stores the position data of the input devices of type `T`. The values are stored as `f32`s, using... |
ButtonInput<GamepadButton> | A "press-able" input of type `T`. ## Usage This type can be used as a resource to keep the curr... |
MeshMaterial3d<StandardMaterial> | A [material](Material) used for rendering a [`Mesh3d`]. See [`Material`] for general information about 3D materials and how to implement your own materials. [`Mesh3d`]... |
Arc | No Documentation 🚧 |
MeshMaterial2d<ColorMaterial> | A [material](Material2d) used for rendering a [`Mesh2d`]. See [`Material2d`] for general information about 2D materials and how to implement your own materials. # Example ``` # use bevy_sprite::{ColorMaterial, MeshMaterial2d}; # use bevy_ecs::prelude::*; # use bevy_render::mesh::{Mesh, Mesh2d}; # use bevy_color::palettes::basic::RED; # use bevy_asset::Assets; # use bevy_math::primitives::Circle; # // Spawn an entity with a mesh using `ColorMaterial`. fn setup( mut commands: Commands, mut meshes: ResMut<Assets |
Time<Unknown> | A generic clock resource that tracks how much it has advanced since its previous update and since ... |
Time<Fixed> | A generic clock resource that tracks how much it has advanced since its previous update and since ... |
Time<Real> | A generic clock resource that tracks how much it has advanced since its previous update and since ... |
Time<Virtual> | A generic clock resource that tracks how much it has advanced since its previous update and since ... |
Range | No Documentation 🚧 |
Range | No Documentation 🚧 |
RangeInclusive | No Documentation 🚧 |
Option<Unknown> | No Documentation 🚧 |
Option<String> | No Documentation 🚧 |
Option<SpatialScale> | No Documentation 🚧 |
Option<Color> | No Documentation 🚧 |
Option<Entity> | No Documentation 🚧 |
Option<TextureAtlas> | No Documentation 🚧 |
Option<ForceTouch> | No Documentation 🚧 |
Option<CompassOctant> | No Documentation 🚧 |
Option<Rect> | No Documentation 🚧 |
Option<URect> | No Documentation 🚧 |
Option<Indices> | No Documentation 🚧 |
Option<ReflectReference> | No Documentation 🚧 |
Option<ScriptValue> | No Documentation 🚧 |
Option<Instant> | No Documentation 🚧 |
Option<SubCameraView> | No Documentation 🚧 |
Option<Viewport> | No Documentation 🚧 |
Option<ReflectSchedule> | No Documentation 🚧 |
Option<ReflectSystem> | No Documentation 🚧 |
Option<WindowTheme> | No Documentation 🚧 |
Option<bool> | No Documentation 🚧 |
Option<char> | No Documentation 🚧 |
Option<NonZeroI16> | No Documentation 🚧 |
Option<NonZeroU16> | No Documentation 🚧 |
Option<NonZeroU32> | No Documentation 🚧 |
Option<f32> | No Documentation 🚧 |
Option<f64> | No Documentation 🚧 |
Option<DVec2> | No Documentation 🚧 |
Option<Vec2> | No Documentation 🚧 |
Option<Vec3> | No Documentation 🚧 |
Option<NodeIndex> | No Documentation 🚧 |
Option<SmolStr> | No Documentation 🚧 |
Option<u16> | No Documentation 🚧 |
Option<u32> | No Documentation 🚧 |
Option<usize> | No Documentation 🚧 |
SmallVec<Unknown> | No Documentation 🚧 |
SmallVec<Unknown> | No Documentation 🚧 |
SmallVec<Unknown> | No Documentation 🚧 |
SmallVec<Unknown> | No Documentation 🚧 |
SmallVec<Unknown> | No Documentation 🚧 |
Vec<Unknown> | No Documentation 🚧 |
Vec<Range> | No Documentation 🚧 |
EntityHashMap<Vec<Cascade>> | A [`HashMap`] pre-configured to use [`EntityHash`] hashing. |
HashSet<Entity> | No Documentation 🚧 |
HashSet<GamepadButton> | No Documentation 🚧 |
Option<Unknown> | No Documentation 🚧 |
Option<Unknown> | No Documentation 🚧 |
Option<Cow> | No Documentation 🚧 |
Option<Vec<String>> | No Documentation 🚧 |
Option<Handle<Image>> | No Documentation 🚧 |
Option<Handle<Mesh>> | No Documentation 🚧 |
Result<Unknown, InteropError> | No Documentation 🚧 |
Result<String, InteropError> | No Documentation 🚧 |
Result<Entity, InteropError> | No Documentation 🚧 |
Result<DynamicFunctionMut, InteropError> | No Documentation 🚧 |
Result<ScriptComponentRegistration, ScriptResourceRegistration> | No Documentation 🚧 |
Result<ScriptComponentRegistration, InteropError> | No Documentation 🚧 |
Result<ScriptQueryBuilder, InteropError> | No Documentation 🚧 |
Result<ReflectReference, InteropError> | No Documentation 🚧 |
Result<ScriptSystemBuilder, InteropError> | No Documentation 🚧 |
Result<ScriptValue, InteropError> | No Documentation 🚧 |
Result<ScriptAttachment, InteropError> | No Documentation 🚧 |
Result<ReflectSystem, InteropError> | No Documentation 🚧 |
Result<bool, InteropError> | No Documentation 🚧 |
HashMap<AnimationTargetId, u64> | No Documentation 🚧 |
HashMap<GamepadAxis, AxisSettings> | No Documentation 🚧 |
HashMap<GamepadButton, ButtonAxisSettings> | No Documentation 🚧 |
HashMap<GamepadButton, ButtonSettings> | No Documentation 🚧 |
HashMap<GamepadInput, f32> | No Documentation 🚧 |
HashMap<NodeIndex, ActiveAnimation> | No Documentation 🚧 |
HashMap<NodeIndex, f32> | No Documentation 🚧 |
Result<Vec<Entity>, InteropError> | No Documentation 🚧 |
Result<Vec<ScriptQueryResult>, InteropError> | No Documentation 🚧 |
Result<Vec<FunctionInfo>, InteropError> | No Documentation 🚧 |
Result<Vec<ReflectSystem>, InteropError> | No Documentation 🚧 |
Result<Option<String>, InteropError> | No Documentation 🚧 |
Result<Option<Entity>, InteropError> | No Documentation 🚧 |
Result<Option<ReflectReference>, InteropError> | No Documentation 🚧 |
Result<Option<ScriptValue>, InteropError> | No Documentation 🚧 |
Result<Option<ReflectSchedule>, InteropError> | No Documentation 🚧 |
Result<Option<ReflectSystem>, InteropError> | No Documentation 🚧 |
Result<Option<usize>, InteropError> | No Documentation 🚧 |
DiGraph | No Documentation 🚧 |
HashMap<String, ScriptValue> | No Documentation 🚧 |
HashMap<AnimationEventTarget, Vec<TimedAnimationEvent>> | No Documentation 🚧 |
HashMap<AssetId<AnimationGraph>, ThreadedAnimationGraph> | No Documentation 🚧 |
HashMap<Entity, Vec<Cascade>> | No Documentation 🚧 |
Result<ScriptTypeRegistration, Result<ScriptComponentRegistration, ScriptResourceRegistration>> | No Documentation 🚧 |
Option<Result<ScriptTypeRegistration, Result<ScriptComponentRegistration, ScriptResourceRegistration>>> | No Documentation 🚧 |
Result<Option<Result<ScriptTypeRegistration, Result<ScriptComponentRegistration, ScriptResourceRegistration>>>, InteropError> | No Documentation 🚧 |
World
Opaque Type. 🔒
Description
The ECS world containing all Components, Resources and Systems. Main point of interaction with a Bevy App.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| exit | Quits the program. |
| has_component | Checks if the given entity has the given component. |
| remove_component | Removes the given component from the entity. |
| register_new_component | Registers a new component type with the world. The component will behave like any other native comp... |
| push_children | Pushes the given children entities into the provided parent entity. |
| get_resource | Retrieves the resource with the given registration. |
| despawn_descendants | Despawn the descendants of the given entity. |
| get_schedule_by_name | Retrieves the schedule with the given name, Also ensures the schedule is initialized before returnin... |
| get_type_by_name | Returns either a `ScriptComponentRegistration` or `ScriptResourceRegistration` depending on the type... |
| insert_children | Inserts the given children entities into the provided parent entity. |
| insert_component | Inserts the given component value into the provided entity |
| despawn_recursive | Despawns the entity and all its descendants. |
| spawn | Spawns a new entity and returns it |
| get_component | Tries to retrieve the given component type on an entity. |
| has_resource | Checks if the world has the given resource. |
| has_entity | Checks if the given entity exists. |
| get_children | Retrieves the children of the given entity. |
| add_system | Adds the given system to the world. |
| add_default_component | Adds the given resource to the world. |
| query | Creates a new `ScriptQueryBuilder` which can be used to query the ECS. Returns: * `query`: The new query builder. |
| despawn | Despawns the given entity. |
| get_parent | Retrieves the parent of the given entity. |
| remove_resource | Removes the given resource from the world. |
exit
Quits the program.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the program was exited successfully. |
has_component
Checks if the given entity has the given component.
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The entity to check. |
| registration | ScriptComponentRegistration | The component to check for. |
Returns
| Name | Type | Documentation |
|---|---|---|
| has_component | bool | Whether the entity has the component. |
remove_component
Removes the given component from the entity.
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The entity to remove the component from. |
| registration | ScriptComponentRegistration | The component to remove. |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the component was removed successfully or didn't exist in the first place. |
register_new_component
Registers a new component type with the world.
The component will behave like any other native component for all intents and purposes. The type that will be instantiated to back this component will be
DynamicComponentwhich contains just one field:
dataThis field can be set to any value and modified freely.
Arguments
| Name | Type | Documentation |
|---|---|---|
| name | String | The name of the component type |
Returns
| Name | Type | Documentation |
|---|---|---|
| registration | ScriptComponentRegistration | The registration of the new component type if successful. |
push_children
Pushes the given children entities into the provided parent entity.
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The parent entity to receive children |
| children | Vec<Entity> | The children entities to push |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the children were pushed successfully. |
get_resource
Retrieves the resource with the given registration.
Arguments
| Name | Type | Documentation |
|---|---|---|
| registration | ScriptResourceRegistration | The registration of the resource to retrieve. |
Returns
| Name | Type | Documentation |
|---|---|---|
| resource | Optional<ReflectReference> | The resource, if it exists. |
despawn_descendants
Despawn the descendants of the given entity.
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The entity to despawn the descendants of. |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the descendants were despawned successfully. |
get_schedule_by_name
Retrieves the schedule with the given name, Also ensures the schedule is initialized before returning it.
Schedules in bevy are "containers" for systems, each schedule runs separately and contains different systems.
By default among others bevy contains the following schedules:
Update: Runs every frame.PostUpdate: Runs after theUpdateschedule.FixedUpdate: Runs at a fixed rate.
Arguments
| Name | Type | Documentation |
|---|---|---|
| name | String | The name of the schedule to retrieve. |
Returns
| Name | Type | Documentation |
|---|---|---|
| schedule | Optional<ReflectSchedule> | The schedule with the given name, if it exists |
get_type_by_name
Returns either a
ScriptComponentRegistrationorScriptResourceRegistrationdepending on the type of the type requested. If the type is neither returns aScriptTypeRegistration.
Arguments
| Name | Type | Documentation |
|---|---|---|
| type_name | String | The name of the type to retrieve. |
Returns
| Name | Type | Documentation |
|---|---|---|
| type | Optional<ScriptTypeRegistration | ScriptComponentRegistration | ScriptResourceRegistration> | The registration of the type, if it exists. |
insert_children
Inserts the given children entities into the provided parent entity.
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The parent entity to receive children |
| index | usize | The index to insert the children at |
| children | Vec<Entity> | The children entities to insert |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the children were inserted successfully. |
insert_component
Inserts the given component value into the provided entity
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The entity to insert the component into. |
| registration | ScriptComponentRegistration | The component registration of the component to insert. |
| value | ReflectReference | The value of the component to insert. Can be constructed using construct |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the component was inserted successfully. |
despawn_recursive
Despawns the entity and all its descendants.
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The entity to despawn recursively. |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the entity and its descendants were despawned successfully. |
spawn
Spawns a new entity and returns it
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The newly spawned entity |
get_component
Tries to retrieve the given component type on an entity.
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The entity to retrieve the component from. |
| registration | ScriptComponentRegistration | The component to retrieve. |
Returns
| Name | Type | Documentation |
|---|---|---|
| component | Optional<ReflectReference> | The component on the entity, if it exists. |
has_resource
Checks if the world has the given resource.
Arguments
| Name | Type | Documentation |
|---|---|---|
| registration | ScriptResourceRegistration | The registration of the resource to check for. |
Returns
| Name | Type | Documentation |
|---|---|---|
| has_resource | bool | Whether the world has the resource. |
has_entity
Checks if the given entity exists.
Arguments
| Name | Type | Documentation |
|---|---|---|
| e | Entity | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| has_entity | bool | Whether the entity exists. |
get_children
Retrieves the children of the given entity.
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The entity to retrieve the children of. |
Returns
| Name | Type | Documentation |
|---|---|---|
| children | Vec<Entity> | The children of the entity. |
add_system
Adds the given system to the world.
Arguments
| Name | Type | Documentation |
|---|---|---|
| schedule | ReflectSchedule | The schedule to add the system to. |
| builder | ScriptSystemBuilder | The system builder specifying the system and its dependencies. |
Returns
| Name | Type | Documentation |
|---|---|---|
| system | ReflectSystem | The system that was added. |
add_default_component
Adds the given resource to the world.
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | No Documentation 🚧 |
| registration | ScriptComponentRegistration | The resource to add. |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the resource was added successfully. |
query
Creates a new
ScriptQueryBuilderwhich can be used to query the ECS.Returns:
query: The new query builder.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | ScriptQueryBuilder | No Documentation 🚧 |
despawn
Despawns the given entity.
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The entity to despawn. |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
get_parent
Retrieves the parent of the given entity.
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The entity to retrieve the parent of. |
Returns
| Name | Type | Documentation |
|---|---|---|
| parent | Optional<Entity> | The parent of the entity |
remove_resource
Removes the given resource from the world.
Arguments
| Name | Type | Documentation |
|---|---|---|
| registration | ScriptResourceRegistration | The resource to remove. |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the resource was removed successfully or didn't exist in the first place. |
ReflectReference
Opaque Type. 🔒
Description
A reference to an arbitrary reflected instance.
The reference can point to either the ECS, or to the allocator.
References are composed of two parts:
- The base kind, which specifies where the reference points to
- The path, which specifies how to access the value from the base.
Bindings defined on this type, apply to ALL references.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| display_ref | Displays this reference without printing the exact contents. This is useful for debugging and loggi... |
| functions | Lists the functions available on the reference. |
| clear | Clears the container, if the reference is an appropriate container type. |
| pop | Pops the value from the reference, if the reference is an appropriate container type. |
| map_get | Gets and clones the value under the specified key if the underlying type is a map type. |
| len | Retrieves the length of the reference, if the reference is an appropriate container type. |
| insert | Inserts the value into the reference at the specified index, if the reference is an appropriate cont... |
| iter | Iterates over the reference, if the reference is an appropriate container type. Returns an "next" i... |
| display_value | Displays the "value" of this reference This is useful for debugging and logging. |
| push | Pushes the value into the reference, if the reference is an appropriate container type. |
| remove | Removes the value at the specified key from the reference, if the reference is an appropriate contai... |
| variant_name | If this type is an enum, will return the name of the variant it represents on the type. |
display_ref
Displays this reference without printing the exact contents.
This is useful for debugging and logging.
Arguments
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The reference to display. |
Returns
| Name | Type | Documentation |
|---|---|---|
| display | String | The display string. |
functions
Lists the functions available on the reference.
Arguments
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The reference to list the functions of. |
Returns
| Name | Type | Documentation |
|---|---|---|
| functions | Vec<FunctionInfo> | The functions available on the reference. |
clear
Clears the container, if the reference is an appropriate container type.
Arguments
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The reference to clear. |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the reference was cleared |
pop
Pops the value from the reference, if the reference is an appropriate container type.
Arguments
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The reference to pop the value from. |
Returns
| Name | Type | Documentation |
|---|---|---|
| value | ScriptValue | The value that was popped, if the reference supports popping. |
map_get
Gets and clones the value under the specified key if the underlying type is a map type.
Arguments
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The reference to index into. |
| key | ScriptValue | The key to index with. |
Returns
| Name | Type | Documentation |
|---|---|---|
| value | Optional<ScriptValue> | The value at the key, if the reference is a map. |
len
Retrieves the length of the reference, if the reference is an appropriate container type.
Arguments
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The reference to get the length of. |
Returns
| Name | Type | Documentation |
|---|---|---|
| len | Optional<usize> | The length of the reference, if the reference is a container. |
insert
Inserts the value into the reference at the specified index, if the reference is an appropriate container type.
Arguments
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The reference to insert the value into. |
| key | ScriptValue | The index to insert the value at. |
| value | ScriptValue | The value to insert. |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the value was inserted successfully. |
iter
Iterates over the reference, if the reference is an appropriate container type.
Returns an "next" iterator function.
The iterator function should be called until it returns
nilto signal the end of the iteration.
Arguments
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The reference to iterate over. |
Returns
| Name | Type | Documentation |
|---|---|---|
| iter | DynamicFunctionMut | The iterator function. |
display_value
Displays the "value" of this reference
This is useful for debugging and logging.
Arguments
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The reference to display. |
Returns
| Name | Type | Documentation |
|---|---|---|
| display | String | The display string. |
push
Pushes the value into the reference, if the reference is an appropriate container type.
Arguments
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The reference to push the value into. |
| value | ScriptValue | The value to push. |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | () | Nothing if the value was pushed successfully. |
remove
Removes the value at the specified key from the reference, if the reference is an appropriate container type.
Arguments
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The reference to remove the value from. |
| key | ScriptValue | The key to remove the value at. |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | ScriptValue | The removed value if any |
variant_name
If this type is an enum, will return the name of the variant it represents on the type.
Arguments
| Name | Type | Documentation |
|---|---|---|
| reference | ReflectReference | The reference to get the variant name of. |
Returns
| Name | Type | Documentation |
|---|---|---|
| variant_name | Optional<String> | The name of the variant, if the reference is an enum. |
ScriptComponentRegistration
ScriptComponentRegistration
- registration:bevy_mod_scripting_core::bindings::query::ScriptTypeRegistration
- component_id:bevy_ecs::component::ComponentId
- is_dynamic_script_component:bool
Description
A reference to a component type's reflection registration.
In general think of this as a handle to a type.
Not to be confused with script registered dynamic components, although this can point to a script registered component.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| short_name | Retrieves the short name of the type. The short name is a more human-readable version of the type na... |
| type_name | Retrieves the name of the type. |
short_name
Retrieves the short name of the type. The short name is a more human-readable version of the type name.
Arguments
| Name | Type | Documentation |
|---|---|---|
| registration | ScriptComponentRegistration | The type registration. |
Returns
| Name | Type | Documentation |
|---|---|---|
| short_name | str | The short name of the |
type_name
Retrieves the name of the type.
Arguments
| Name | Type | Documentation |
|---|---|---|
| registration | ScriptComponentRegistration | The type registration. |
Returns
| Name | Type | Documentation |
|---|---|---|
| type_name | str | The name of the type. |
ScriptQueryBuilder
Opaque Type. 🔒
Description
The query builder is used to build ECS queries which retrieve spefific components filtered by specific conditions.
For example:
builder.component(componentA) .component(componentB) .with(componentC) .without(componentD)Will retrieve entities which:
- Have componentA
- Have componentB
- Have componentC
- Do not have componentD
As well as references to components:
- componentA
- componentB
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| without | Adds a component to filter the query by. This component will NOT be retrieved. |
| component | Adds a component to be retrieved by the query |
| with | Adds a component to filter the query by. This component will NOT be retrieved. |
| build | Builds the query and retrieves the entities and component references. |
without
Adds a component to filter the query by. This component will NOT be retrieved.
Arguments
| Name | Type | Documentation |
|---|---|---|
| query | ScriptQueryBuilder | The query to add the component to |
| without | ScriptComponentRegistration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| query | ScriptQueryBuilder | The query with the component added |
component
Adds a component to be retrieved by the query
Arguments
| Name | Type | Documentation |
|---|---|---|
| query | ScriptQueryBuilder | The query to add the component to |
| components | ScriptComponentRegistration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| query | ScriptQueryBuilder | The query with the component added |
with
Adds a component to filter the query by. This component will NOT be retrieved.
Arguments
| Name | Type | Documentation |
|---|---|---|
| query | ScriptQueryBuilder | The query to add the component to |
| with | ScriptComponentRegistration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| query | ScriptQueryBuilder | The query with the component added |
build
Builds the query and retrieves the entities and component references.
Arguments
| Name | Type | Documentation |
|---|---|---|
| query | ScriptQueryBuilder | The query to build. |
Returns
| Name | Type | Documentation |
|---|---|---|
| result | Vec<ScriptQueryResult> | The entities and component references that match the query. |
ScriptQueryResult
Opaque Type. 🔒
Description
A result from a query.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| entity | Retrieves the entity from the query result. |
| components | Retrieves the components from the query result. These are ordered by the order they were added to t... |
entity
Retrieves the entity from the query result.
Arguments
| Name | Type | Documentation |
|---|---|---|
| query | ScriptQueryResult | The query result to retrieve the entity from. |
Returns
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The entity from the query result. |
components
Retrieves the components from the query result.
These are ordered by the order they were added to the query.
Arguments
| Name | Type | Documentation |
|---|---|---|
| query | ScriptQueryResult | The query result to retrieve the components from. |
Returns
| Name | Type | Documentation |
|---|---|---|
| components | Vec<ReflectReference> | The components from the query result. |
ScriptResourceRegistration
ScriptResourceRegistration
- registration:bevy_mod_scripting_core::bindings::query::ScriptTypeRegistration
- resource_id:bevy_ecs::component::ComponentId
Description
A reference to a resource type's reflection registration.
In general think of this as a handle to a type.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| type_name | Retrieves the name of the type. |
| short_name | Retrieves the short name of the type. The short name is a more human-readable version of the type na... |
type_name
Retrieves the name of the type.
Arguments
| Name | Type | Documentation |
|---|---|---|
| registration | ScriptResourceRegistration | The type registration. |
Returns
| Name | Type | Documentation |
|---|---|---|
| type_name | str | The name of the type. |
short_name
Retrieves the short name of the type. The short name is a more human-readable version of the type name.
Arguments
| Name | Type | Documentation |
|---|---|---|
| registration | ScriptResourceRegistration | The type registration. |
Returns
| Name | Type | Documentation |
|---|---|---|
| short_name | str | The short name of the |
ScriptTypeRegistration
Opaque Type. 🔒
Description
A reference to a type which is not a
ResourceorComponent.In general think of this as a handle to a type.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| type_name | Retrieves the name of the type. |
| short_name | Retrieves the short name of the type. The short name is a more human-readable version of the type na... |
type_name
Retrieves the name of the type.
Arguments
| Name | Type | Documentation |
|---|---|---|
| registration | ScriptTypeRegistration | The type registration. |
Returns
| Name | Type | Documentation |
|---|---|---|
| type_name | String | The name of the type. |
short_name
Retrieves the short name of the type. The short name is a more human-readable version of the type name.
Arguments
| Name | Type | Documentation |
|---|---|---|
| registration | ScriptTypeRegistration | The type registration. |
Returns
| Name | Type | Documentation |
|---|---|---|
| short_name | String | The short name of the |
ScriptSystemBuilder
Opaque Type. 🔒
Description
A builder for systems living in scripts
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| query | Adds a query to the system builder. |
| after | Specifies the system is to run *after* the given system Note: this is an experimental feature, and ... |
| exclusive | Specifies the system is to run exclusively, meaning it can access anything, but will not run in para... |
| resource | Requests the system have access to the given resource. The resource will be added to the list of arg... |
| before | Specifies the system is to run *before* the given system. Note: this is an experimental feature, an... |
query
Adds a query to the system builder.
Arguments
| Name | Type | Documentation |
|---|---|---|
| builder | ScriptSystemBuilder | The system builder to add the query to. |
| query | ScriptQueryBuilder | The query to add. |
Returns
| Name | Type | Documentation |
|---|---|---|
| builder | ScriptSystemBuilder | The system builder with the query added. |
after
Specifies the system is to run after the given system
Note: this is an experimental feature, and the ordering might not work correctly for script initialized systems
Arguments
| Name | Type | Documentation |
|---|---|---|
| builder | ScriptSystemBuilder | The system builder to add the dependency to. |
| system | ReflectSystem | The system to run after. |
Returns
| Name | Type | Documentation |
|---|---|---|
| builder | ScriptSystemBuilder | The system builder with the dependency added. |
exclusive
Specifies the system is to run exclusively, meaning it can access anything, but will not run in parallel with other systems.
Arguments
| Name | Type | Documentation |
|---|---|---|
| builder | ScriptSystemBuilder | The system builder to make exclusive. |
Returns
| Name | Type | Documentation |
|---|---|---|
| builder | ScriptSystemBuilder | The system builder that is now exclusive. |
resource
Requests the system have access to the given resource. The resource will be added to the list of arguments of the callback in the order they're provided.
Arguments
| Name | Type | Documentation |
|---|---|---|
| builder | ScriptSystemBuilder | The system builder to add the resource to. |
| resource | ScriptResourceRegistration | The resource to add. |
Returns
| Name | Type | Documentation |
|---|---|---|
| builder | ScriptSystemBuilder | The system builder with the resource added. |
before
Specifies the system is to run before the given system.
Note: this is an experimental feature, and the ordering might not work correctly for script initialized systems
Arguments
| Name | Type | Documentation |
|---|---|---|
| builder | ScriptSystemBuilder | The system builder to add the dependency to. |
| system | ReflectSystem | The system to run before. |
Returns
| Name | Type | Documentation |
|---|---|---|
| builder | ScriptSystemBuilder | The system builder with the dependency added. |
ScriptAttachment
EntityScript
- bevy_ecs::entity::Entity
- bevy_asset::handle::Handle<bevy_mod_scripting_core::asset::ScriptAsset>
StaticScript
- bevy_asset::handle::Handle<bevy_mod_scripting_core::asset::ScriptAsset>
Description
Specifies a unique attachment of a script. These attachments are mapped to [
ContextKey]'s depending on the context policy used.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new_entity_script | Creates a new script attachment descriptor for an entity attached script. |
| new_static_script | Creates a new script attachment descriptor from a script asset. |
new_entity_script
Creates a new script attachment descriptor for an entity attached script.
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | The entity to attach the script to. |
| script | Handle<ScriptAsset> | The script asset to attach to the entity. |
Returns
| Name | Type | Documentation |
|---|---|---|
| attachment | ScriptAttachment | The new script attachment for the entity. |
new_static_script
Creates a new script attachment descriptor from a script asset.
Arguments
| Name | Type | Documentation |
|---|---|---|
| script | Handle<ScriptAsset> | The script asset to create the attachment from. |
Returns
| Name | Type | Documentation |
|---|---|---|
| attachment | ScriptAttachment | The new script attachment. |
ReflectSchedule
ReflectSchedule
- type_path:str
- label:bevy_system_reflection::ReflectableScheduleLabel
Description
A reflectable schedule.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| systems | Retrieves all the systems in the schedule. |
| render_dot | Renders the schedule as a dot graph string. Useful for debugging scheduling. |
| get_system_by_name | Retrieves the system with the given name in the schedule |
systems
Retrieves all the systems in the schedule.
Arguments
| Name | Type | Documentation |
|---|---|---|
| schedule | ReflectSchedule | The schedule to retrieve the systems from. |
Returns
| Name | Type | Documentation |
|---|---|---|
| systems | Vec<ReflectSystem> | The systems in the schedule. |
render_dot
Renders the schedule as a dot graph string.
Useful for debugging scheduling.
Arguments
| Name | Type | Documentation |
|---|---|---|
| schedule | ReflectSchedule | The schedule to render. |
Returns
| Name | Type | Documentation |
|---|---|---|
| dot | String | The dot graph string. |
get_system_by_name
Retrieves the system with the given name in the schedule
Arguments
| Name | Type | Documentation |
|---|---|---|
| schedule | ReflectSchedule | The schedule to retrieve the system from. |
| name | String | The identifier or full path of the system to retrieve. |
Returns
| Name | Type | Documentation |
|---|---|---|
| system | Optional<ReflectSystem> | The system with the given name, if it exists. |
ReflectSystem
Opaque Type. 🔒
Description
A reflectable system.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| identifier | Retrieves the identifier of the system |
| path | Retrieves the full path of the system |
identifier
Retrieves the identifier of the system
Arguments
| Name | Type | Documentation |
|---|---|---|
| system | ReflectSystem | The system to retrieve the identifier from. |
Returns
| Name | Type | Documentation |
|---|---|---|
| identifier | String | The identifier of the system, e.g. my_system |
path
Retrieves the full path of the system
Arguments
| Name | Type | Documentation |
|---|---|---|
| system | ReflectSystem | The system to retrieve the path from. |
Returns
| Name | Type | Documentation |
|---|---|---|
| path | String | The full path of the system, e.g. my_crate::systems::my_system<T> |
Handle<ScriptAsset>
Strong
- bevy_platform::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_mod_scripting_core::asset::ScriptAsset>
Description
A handle to a specific [
Asset] of typeA. Handles act as abstract "references" to assets, whose data are stored in theAssets<A>resource, avoiding the need to store multiple copies of the same data.If a [
Handle] is [Handle::Strong], the [Asset] will be kept alive until the [Handle] is dropped. If a [Handle] is [Handle::Weak], it does not necessarily reference a live [Asset], nor will it keep assets alive.Modifying a handle will change which existing asset is referenced, but modifying the asset (by mutating the
Assetsresource) will change the asset for all handles referencing it.[
Handle] can be cloned. If a [Handle::Strong] is cloned, the referenced [Asset] will not be freed until all instances of the [Handle] are dropped.[
Handle::Strong], via [StrongHandle] also provides access to useful [Asset] metadata, such as the [AssetPath] (if it exists).
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| asset_path | Retrieves the path of the script asset if present. Assets can be unloaded, and as such if the given ... |
asset_path
Retrieves the path of the script asset if present. Assets can be unloaded, and as such if the given handle is no longer active, this will return
None.
Arguments
| Name | Type | Documentation |
|---|---|---|
| handle | Handle<ScriptAsset> | The handle to the script asset. |
Returns
| Name | Type | Documentation |
|---|---|---|
| path | Optional<String> | The asset path of the script asset. |
ComponentId
ComponentId
- usize
Description
A value which uniquely identifies the type of a [
Component] or [Resource] within a [World].Each time a new
Componenttype is registered within aWorldusing e.g. [World::register_component] or [World::register_component_with_descriptor] or a Resource with e.g. [World::init_resource], a correspondingComponentIdis created to track it.While the distinction between
ComponentIdand [TypeId] may seem superficial, breaking them into two separate but related concepts allows components to exist outside of Rust's type system. Each Rust type registered as aComponentwill have a correspondingComponentId, but additionalComponentIds may exist in aWorldto track components which cannot be represented as Rust types for scripting or other advanced use-cases.A
ComponentIdis tightly coupled to its parentWorld. Attempting to use aComponentIdfrom oneWorldto access the metadata of aComponentin a differentWorldis undefined behavior and must not be attempted.Given a type
Twhich implements [Component], theComponentIdforTcan be retrieved from aWorldusing [World::component_id()] or via [Components::component_id()]. Access to theComponentIdfor a [Resource] is available via [Components::resource_id()].
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| new | Creates a new [`ComponentId`]. The `index` is a unique value associated with each type of component in a given world. Usually, this value is taken from a counter incremented for each type of component registered with the world. |
| index | Returns the index of the current component. |
| eq | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ComponentId | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | ComponentId | No Documentation 🚧 |
new
Creates a new [
ComponentId]. Theindexis a unique value associated with each type of component in a given world. Usually, this value is taken from a counter incremented for each type of component registered with the world.
Arguments
| Name | Type | Documentation |
|---|---|---|
| index | usize | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | ComponentId | No Documentation 🚧 |
index
Returns the index of the current component.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ComponentId | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | usize | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ComponentId | No Documentation 🚧 |
| other | ComponentId | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ComponentId | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
ComponentTicks
ComponentTicks
- added:bevy_ecs::component::Tick
- changed:bevy_ecs::component::Tick
Description
Records when a component or resource was added and when it was last mutably dereferenced (or added).
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates a new instance with the same change tick for `added` and `changed`. |
| is_added | Returns `true` if the component or resource was added after the system last ran (or the system is ... |
| set_changed | Manually sets the change tick. This is normally done automatically via the [`DerefMut`] implementation on [`Mut |
| clone | No Documentation 🚧 |
| is_changed | Returns `true` if the component or resource was added or mutably dereferenced after the system last... |
new
Creates a new instance with the same change tick for
addedandchanged.
Arguments
| Name | Type | Documentation |
|---|---|---|
| change_tick | Tick | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | ComponentTicks | No Documentation 🚧 |
is_added
Returns
trueif the component or resource was added after the system last ran (or the system is running for the first time).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ComponentTicks | No Documentation 🚧 |
| last_run | Tick | No Documentation 🚧 |
| this_run | Tick | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
set_changed
Manually sets the change tick. This is normally done automatically via the [
DerefMut] implementation onMut<T>,ResMut<T>, etc. However, components and resources that make use of interior mutability might require manual updates.Example
# use bevy_ecs::{world::World, component::ComponentTicks}; let world: World = unimplemented!(); let component_ticks: ComponentTicks = unimplemented!(); component_ticks.set_changed(world.read_change_tick());
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ComponentTicks | No Documentation 🚧 |
| change_tick | Tick | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ComponentTicks | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | ComponentTicks | No Documentation 🚧 |
is_changed
Returns
trueif the component or resource was added or mutably dereferenced after the system last ran (or the system is running for the first time).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ComponentTicks | No Documentation 🚧 |
| last_run | Tick | No Documentation 🚧 |
| this_run | Tick | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
Tick
Tick
- tick:u32
Description
A value that tracks when a system ran relative to other systems. This is used to power change detection.
Note that a system that hasn't been run yet has a
Tickof 0.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| get | Gets the value of this change tick. |
| is_newer_than | Returns `true` if this `Tick` occurred since the system's `last_run`. `this_run` is the current ti... |
| set | Sets the value of this change tick. |
| new | Creates a new [`Tick`] wrapping the given value. |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
get
Gets the value of this change tick.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Tick | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
is_newer_than
Returns
trueif thisTickoccurred since the system'slast_run.this_runis the current tick of the system, used as a reference to help deal with wraparound.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Tick | No Documentation 🚧 |
| last_run | Tick | No Documentation 🚧 |
| this_run | Tick | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
set
Sets the value of this change tick.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
new
Creates a new [
Tick] wrapping the given value.
Arguments
| Name | Type | Documentation |
|---|---|---|
| tick | u32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Tick | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Tick | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Tick | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Tick | No Documentation 🚧 |
Entity
Opaque Type. 🔒
Description
Lightweight identifier of an entity.
The identifier is implemented using a generational index: a combination of an index and a generation. This allows fast insertion after data removal in an array while minimizing loss of spatial locality.
These identifiers are only valid on the
Worldit's sourced from. Attempting to use anEntityto fetch entity components or metadata from a different world will either fail or return unexpected results.Stability warning
For all intents and purposes,
Entityshould be treated as an opaque identifier. The internal bit representation is liable to change from release to release as are the behaviors or performance characteristics of any of its trait implementations (i.e.Ord,Hash, etc.). This means that changes inEntity's representation, though made readable through various functions on the type, are not considered breaking changes under SemVer.In particular, directly serializing with
SerializeandDeserializemake zero guarantee of long term wire format compatibility. Changes in behavior will cause serializedEntityvalues persisted to long term storage (i.e. disk, databases, etc.) will fail to deserialize upon being updated.Usage
This data type is returned by iterating a
Querythat hasEntityas part of its query fetch type parameter (learn more). It can also be obtained by callingEntityCommands::idorEntityWorldMut::id.# use bevy_ecs::prelude::*; # #[derive(Component)] # struct SomeComponent; fn setup(mut commands: Commands) { // Calling `spawn` returns `EntityCommands`. let entity = commands.spawn(SomeComponent).id(); } fn exclusive_system(world: &mut World) { // Calling `spawn` returns `EntityWorldMut`. let entity = world.spawn(SomeComponent).id(); } # # bevy_ecs::system::assert_is_system(setup); # bevy_ecs::system::assert_is_system(exclusive_system);It can be used to refer to a specific entity to apply
EntityCommands, or to callQuery::get(or similar methods) to access its components.# use bevy_ecs::prelude::*; # # #[derive(Component)] # struct Expired; # fn dispose_expired_food(mut commands: Commands, query: Query<Entity, With<Expired>>) { for food_entity in &query { commands.entity(food_entity).despawn(); } } # # bevy_ecs::system::assert_is_system(dispose_expired_food);
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| to_bits | Convert to a form convenient for passing outside of rust. Only useful for identifying entities wit... |
| eq | No Documentation 🚧 |
| index | Return a transiently unique identifier. No two simultaneously-live entities share the same index, ... |
| from_raw | Creates a new entity ID with the specified `index` and a generation of 1. # Note Spawning a speci... |
| clone | No Documentation 🚧 |
| generation | Returns the generation of this Entity's index. The generation is incremented each time an entity w... |
| from_bits | Reconstruct an `Entity` previously destructured with [`Entity::to_bits`]. Only useful when applied to results from `to_bits` in the same instance of an application. # Panics This method will likely panic if given `u64` values that did not come from [`Entity::to_bits`]... |
to_bits
Convert to a form convenient for passing outside of rust. Only useful for identifying entities within the same instance of an application. Do not use for serialization between runs. No particular structure is guaranteed for the returned bits.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Entity | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
index
Return a transiently unique identifier. No two simultaneously-live entities share the same index, but dead entities' indices may collide with both live and dead entities. Useful for compactly representing entities within a specific snapshot of the world, such as when serializing.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Entity | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
from_raw
Creates a new entity ID with the specified
indexand a generation of 1.Note
Spawning a specific
entityvalue is rarely the right choice. Most apps should favorCommands::spawn. This method should generally only be used for sharing entities across apps, and only when they have a scheme worked out to share an index space (which doesn't happen by default). In general, one should not try to synchronize the ECS by attempting to ensure thatEntitylines up between instances, but instead insert a secondary identifier as a component.
Arguments
| Name | Type | Documentation |
|---|---|---|
| index | u32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Entity | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Entity | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Entity | No Documentation 🚧 |
generation
Returns the generation of this Entity's index. The generation is incremented each time an entity with a given index is despawned. This serves as a "count" of the number of times a given index has been reused (index, generation) pairs uniquely identify a given Entity.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Entity | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
from_bits
Reconstruct an
Entitypreviously destructured with [Entity::to_bits]. Only useful when applied to results fromto_bitsin the same instance of an application.Panics
This method will likely panic if given
u64values that did not come from [Entity::to_bits].
Arguments
| Name | Type | Documentation |
|---|---|---|
| bits | u64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Entity | No Documentation 🚧 |
EntityHash
EntityHash
Description
A [
BuildHasher] that results in a [EntityHasher].
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | EntityHash | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | EntityHash | No Documentation 🚧 |
EntityHashSet
EntityHashSet
- bevy_platform::collections::HashSet<bevy_ecs::entity::Entity, bevy_ecs::entity::hash::EntityHash>
Description
A [
HashSet] pre-configured to use [EntityHash] hashing.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates an empty `EntityHashSet`. Equivalent to [`HashSet::with_hasher(EntityHash)`]. [`HashSet::with_hasher(EntityHash)`... |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| with_capacity | Creates an empty `EntityHashSet` with the specified capacity. Equivalent to [`HashSet::with_capacity_and_hasher(n, EntityHash)`]. [`HashSet::with_... |
| len | Returns the number of elements in the set. |
| is_empty | Returns `true` if the set contains no elements. |
| assert_receiver_is_total_eq | No Documentation 🚧 |
new
Creates an empty
EntityHashSet. Equivalent to [HashSet::with_hasher(EntityHash)]. [HashSet::with_hasher(EntityHash)]: HashSet::with_hasher
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | EntityHashSet | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | EntityHashSet | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | EntityHashSet | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | EntityHashSet | No Documentation 🚧 |
| other | EntityHashSet | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
with_capacity
Creates an empty
EntityHashSetwith the specified capacity. Equivalent to [HashSet::with_capacity_and_hasher(n, EntityHash)]. [HashSet::with_capacity_and_hasher(n, EntityHash)]: HashSet::with_capacity_and_hasher
Arguments
| Name | Type | Documentation |
|---|---|---|
| n | usize | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | EntityHashSet | No Documentation 🚧 |
len
Returns the number of elements in the set.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | EntityHashSet | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | usize | No Documentation 🚧 |
is_empty
Returns
trueif the set contains no elements.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | EntityHashSet | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | EntityHashSet | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
DefaultQueryFilters
DefaultQueryFilters
- disabling:smallvec::SmallVec<[bevy_ecs::component::ComponentId; 4]>
Description
Default query filters work by excluding entities with certain components from most queries.
If a query does not explicitly mention a given disabling component, it will not include entities with that component. To be more precise, this checks if the query's [
FilteredAccess] contains the component, and if it does not, adds aWithoutfilter for that component to the query.This resource is initialized in the [
World] whenever a new world is created, with the [Disabled] component as a disabling component.Note that you can remove default query filters by overwriting the [
DefaultQueryFilters] resource. This can be useful as a last resort escape hatch, but is liable to break compatibility with other libraries.See the module docs for more info.
Warning
Default query filters are a global setting that affects all queries in the [
World], and incur a small performance cost for each query.They can cause significant interoperability issues within the ecosystem, as users must be aware of each disabling component in use.
Think carefully about whether you need to use a new disabling component, and clearly communicate their presence in any libraries you publish.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| register_disabling_component | Adds this [`ComponentId`] to the set of [`DefaultQueryFilters`], causing entities with this compon... |
| empty | Creates a new, completely empty [`DefaultQueryFilters`]. This is provided as an escape hatch; in most cases you should initialize this using [`FromWorld`]... |
register_disabling_component
Adds this [
ComponentId] to the set of [DefaultQueryFilters], causing entities with this component to be excluded from queries. This method is idempotent, and will not add the same component multiple times.Warning
This method should only be called before the app starts, as it will not affect queries initialized before it is called. As discussed in the module docs, this can have performance implications, as well as create interoperability issues, and should be used with caution.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DefaultQueryFilters | No Documentation 🚧 |
| component_id | ComponentId | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
empty
Creates a new, completely empty [
DefaultQueryFilters]. This is provided as an escape hatch; in most cases you should initialize this using [FromWorld], which is automatically called when creating a new [World].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DefaultQueryFilters | No Documentation 🚧 |
Disabled
Disabled
Description
A marker component for disabled entities.
Semantically, this component is used to mark entities that are temporarily disabled (typically for gameplay reasons), but will likely be re-enabled at some point.
Like all disabling components, this only disables the entity itself, not its children or other entities that reference it. To disable an entire tree of entities, use
EntityCommands::insert_recursive.Every [
World] has a default query filter that excludes entities with this component, registered in the [DefaultQueryFilters] resource. See the module docs for more info.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Disabled | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Disabled | No Documentation 🚧 |
ChildOf
ChildOf
- bevy_ecs::entity::Entity
Description
Stores the parent entity of this child entity with this component.
This is a
Relationshipcomponent, and creates the canonical "parent / child" hierarchy. This is the "source of truth" component, and it pairs with the [Children]RelationshipTarget.This relationship should be used for things like:
- Organizing entities in a scene
- Propagating configuration or data inherited from a parent, such as "visibility" or "world-space global transforms".
- Ensuring a hierarchy is despawned when an entity is despawned.
[
ChildOf] contains a single "target" [Entity]. When [ChildOf] is inserted on a "source" entity, the "target" entity will automatically (and immediately, via a component hook) have a [Children] component inserted, and the "source" entity will be added to that [Children] instance.If the [
ChildOf] component is replaced with a different "target" entity, the old target's [Children] will be automatically (and immediately, via a component hook) be updated to reflect that change.Likewise, when the [
ChildOf] component is removed, the "source" entity will be removed from the old target's [Children]. If this results in [Children] being empty, [Children] will be automatically removed.When a parent is despawned, all children (and their descendants) will also be despawned.
You can create parent-child relationships in a variety of ways. The most direct way is to insert a [
ChildOf] component:# use bevy_ecs::prelude::*; # let mut world = World::new(); let root = world.spawn_empty().id(); let child1 = world.spawn(ChildOf(root)).id(); let child2 = world.spawn(ChildOf(root)).id(); let grandchild = world.spawn(ChildOf(child1)).id(); assert_eq!(&**world.entity(root).get::<Children>().unwrap(), &[child1, child2]); assert_eq!(&**world.entity(child1).get::<Children>().unwrap(), &[grandchild]); world.entity_mut(child2).remove::<ChildOf>(); assert_eq!(&**world.entity(root).get::<Children>().unwrap(), &[child1]); world.entity_mut(root).despawn(); assert!(world.get_entity(root).is_err()); assert!(world.get_entity(child1).is_err()); assert!(world.get_entity(grandchild).is_err());However if you are spawning many children, you might want to use the [
EntityWorldMut::with_children] helper instead:# use bevy_ecs::prelude::*; # let mut world = World::new(); let mut child1 = Entity::PLACEHOLDER; let mut child2 = Entity::PLACEHOLDER; let mut grandchild = Entity::PLACEHOLDER; let root = world.spawn_empty().with_children(|p| { child1 = p.spawn_empty().with_children(|p| { grandchild = p.spawn_empty().id(); }).id(); child2 = p.spawn_empty().id(); }).id(); assert_eq!(&**world.entity(root).get::<Children>().unwrap(), &[child1, child2]); assert_eq!(&**world.entity(child1).get::<Children>().unwrap(), &[grandchild]);
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| get | The parent entity of this child entity. |
| clone | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| parent | The parent entity of this child entity. |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
get
The parent entity of this child entity.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ChildOf | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Entity | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ChildOf | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | ChildOf | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ChildOf | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
parent
The parent entity of this child entity.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ChildOf | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Entity | No Documentation 🚧 |
Children
Children
- alloc::vec::Vec<bevy_ecs::entity::Entity>
Description
Tracks which entities are children of this parent entity.
A
RelationshipTargetcollection component that is populated with entities that "target" this entity with the [ChildOf]Relationshipcomponent.Together, these components form the "canonical parent-child hierarchy". See the [
ChildOf] component for the full description of this relationship and instructions on how to use it.Usage
Like all
RelationshipTargetcomponents, this data should not be directly manipulated to avoid desynchronization. Instead, modify the [ChildOf] components on the "source" entities.To access the children of an entity, you can iterate over the [
Children] component, using the [IntoIterator] trait. For more complex access patterns, see theRelationshipTargettrait.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| swap | Swaps the child at `a_index` with the child at `b_index`. |
| assert_receiver_is_total_eq | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
swap
Swaps the child at
a_indexwith the child atb_index.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Children | No Documentation 🚧 |
| a_index | usize | No Documentation 🚧 |
| b_index | usize | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Children | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
Identifier
Opaque Type. 🔒
Description
A unified identifier for all entity and similar IDs.
Has the same size as a
u64integer, but the layout is split between a 32-bit low segment, a 31-bit high segment, and the significant bit reserved as type flags to denote entity kinds.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| to_bits | Convert the [`Identifier`] into a `u64`. |
| from_bits | Convert a `u64` into an [`Identifier`]. # Panics This method will likely panic if given `u64` values that did not come from [`Identifier::to_bits`]... |
| masked_high | Returns the masked value of the high segment of the [`Identifier`]. Does not include the flag bits. |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| low | Returns the value of the low segment of the [`Identifier`]. |
to_bits
Convert the [
Identifier] into au64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Identifier | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
from_bits
Convert a
u64into an [Identifier].Panics
This method will likely panic if given
u64values that did not come from [Identifier::to_bits].
Arguments
| Name | Type | Documentation |
|---|---|---|
| value | u64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Identifier | No Documentation 🚧 |
masked_high
Returns the masked value of the high segment of the [
Identifier]. Does not include the flag bits.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Identifier | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Identifier | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Identifier | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Identifier | No Documentation 🚧 |
| other | Identifier | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
low
Returns the value of the low segment of the [
Identifier].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Identifier | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
Name
Name
- hash:u64
- name:alloc::borrow::Cow
Description
Component used to identify an entity. Stores a hash for faster comparisons.
The hash is eagerly re-computed upon each update to the name.
[
Name] should not be treated as a globally unique identifier for entities, as multiple entities can have the same name. [Entity] should be used instead as the default unique identifier.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Name | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Name | No Documentation 🚧 |
RemovedComponentEntity
RemovedComponentEntity
- bevy_ecs::entity::Entity
Description
Wrapper around [
Entity] for [RemovedComponents]. Internally,RemovedComponentsuses these as anEvents<RemovedComponentEntity>.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RemovedComponentEntity | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RemovedComponentEntity | No Documentation 🚧 |
ButtonState
Pressed
Released
Description
The current "press" state of an element
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| is_pressed | Is this button pressed? |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonState | No Documentation 🚧 |
| other | ButtonState | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonState | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonState | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | ButtonState | No Documentation 🚧 |
is_pressed
Is this button pressed?
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonState | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
AxisSettings
AxisSettings
- livezone_upperbound:f32
- deadzone_upperbound:f32
- deadzone_lowerbound:f32
- livezone_lowerbound:f32
- threshold:f32
Description
Settings for a [
GamepadAxis].It is used inside the [
GamepadSettings] to define the sensitivity range and threshold for an axis. Values that are higher thanlivezone_upperboundwill be rounded up to 1.0. Values that are lower thanlivezone_lowerboundwill be rounded down to -1.0. Values that are in-betweendeadzone_lowerboundanddeadzone_upperboundwill be rounded to 0.0. Otherwise, values will be linearly rescaled to fit into the sensitivity range. For example, a value that is one fourth of the way fromdeadzone_upperboundtolivezone_upperboundwill be scaled to 0.25.The valid range is
[-1.0, 1.0].
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| set_threshold | Try to set the minimum value by which input must change before the changes will be applied. If the... |
| clamp | Clamps the `raw_value` according to the `AxisSettings`. |
| set_deadzone_lowerbound | Try to set the value above which inputs will be rounded up to 0.0. If the value passed is less tha... |
| set_livezone_lowerbound | Try to set the value below which negative inputs will be rounded down to -1.0. If the value passed... |
| livezone_lowerbound | Get the value below which negative inputs will be rounded down to -1.0. |
| eq | No Documentation 🚧 |
| livezone_upperbound | Get the value above which inputs will be rounded up to 1.0. |
| set_deadzone_upperbound | Try to set the value below which positive inputs will be rounded down to 0.0. If the value passed ... |
| deadzone_upperbound | Get the value below which positive inputs will be rounded down to 0.0. |
| set_livezone_upperbound | Try to set the value above which inputs will be rounded up to 1.0. If the value passed is negative... |
| deadzone_lowerbound | Get the value above which inputs will be rounded up to 0.0. |
| threshold | Get the minimum value by which input must change before the change is registered. |
| clone | No Documentation 🚧 |
set_threshold
Try to set the minimum value by which input must change before the changes will be applied. If the value passed is not within [0.0..=2.0], the value will not be changed. Returns the new value of threshold.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
clamp
Clamps the
raw_valueaccording to theAxisSettings.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
| raw_value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
set_deadzone_lowerbound
Try to set the value above which inputs will be rounded up to 0.0. If the value passed is less than -1.0 or less than
livezone_lowerbound, the value will not be changed. Returns the new value ofdeadzone_lowerbound.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
set_livezone_lowerbound
Try to set the value below which negative inputs will be rounded down to -1.0. If the value passed is positive or greater than
deadzone_lowerbound, the value will not be changed. Returns the new value oflivezone_lowerbound.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
livezone_lowerbound
Get the value below which negative inputs will be rounded down to -1.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
| other | AxisSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
livezone_upperbound
Get the value above which inputs will be rounded up to 1.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
set_deadzone_upperbound
Try to set the value below which positive inputs will be rounded down to 0.0. If the value passed is negative or greater than
livezone_upperbound, the value will not be changed. Returns the new value ofdeadzone_upperbound.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
deadzone_upperbound
Get the value below which positive inputs will be rounded down to 0.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
set_livezone_upperbound
Try to set the value above which inputs will be rounded up to 1.0. If the value passed is negative or less than
deadzone_upperbound, the value will not be changed. Returns the new value oflivezone_upperbound.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
deadzone_lowerbound
Get the value above which inputs will be rounded up to 0.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
threshold
Get the minimum value by which input must change before the change is registered.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AxisSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AxisSettings | No Documentation 🚧 |
ButtonAxisSettings
ButtonAxisSettings
- high:f32
- low:f32
- threshold:f32
Description
Settings for a [
GamepadButton].It is used inside the [
GamepadSettings] to define the sensitivity range and threshold for a button axis.Logic
- Values that are higher than or equal to
highwill be rounded to 1.0.- Values that are lower than or equal to
lowwill be rounded to 0.0.- Otherwise, values will not be rounded.
The valid range is from 0.0 to 1.0, inclusive.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonAxisSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | ButtonAxisSettings | No Documentation 🚧 |
ButtonSettings
ButtonSettings
- press_threshold:f32
- release_threshold:f32
Description
Manages settings for gamepad buttons.
It is used inside [
GamepadSettings] to define the threshold for a [GamepadButton] to be considered pressed or released. A button is considered pressed if thepress_thresholdvalue is surpassed and released if therelease_thresholdvalue is undercut.Allowed values:
0.0 <= ``release_threshold`` <= ``press_threshold`` <= 1.0
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| is_pressed | Returns `true` if the button is pressed. A button is considered pressed if the `value` passed is g... |
| clone | No Documentation 🚧 |
| set_press_threshold | Try to set the button input threshold above which the button is considered pressed. If the value p... |
| set_release_threshold | Try to set the button input threshold below which the button is considered released. If the value ... |
| press_threshold | Get the button input threshold above which the button is considered pressed. |
| eq | No Documentation 🚧 |
| is_released | Returns `true` if the button is released. A button is considered released if the `value` passed is... |
| release_threshold | Get the button input threshold below which the button is considered released. |
is_pressed
Returns
trueif the button is pressed. A button is considered pressed if thevaluepassed is greater than or equal to the press threshold.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonSettings | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | ButtonSettings | No Documentation 🚧 |
set_press_threshold
Try to set the button input threshold above which the button is considered pressed. If the value passed is outside the range [release threshold..=1.0], the value will not be changed. Returns the new value of the press threshold.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonSettings | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
set_release_threshold
Try to set the button input threshold below which the button is considered released. If the value passed is outside the range [0.0..=press threshold], the value will not be changed. Returns the new value of the release threshold.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonSettings | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
press_threshold
Get the button input threshold above which the button is considered pressed.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonSettings | No Documentation 🚧 |
| other | ButtonSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_released
Returns
trueif the button is released. A button is considered released if thevaluepassed is lower than or equal to the release threshold.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonSettings | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
release_threshold
Get the button input threshold below which the button is considered released.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ButtonSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
Gamepad
Gamepad
- vendor_id:core::option::Option
- product_id:core::option::Option
- digital:bevy_input::button_input::ButtonInput<bevy_input::gamepad::GamepadButton>
- analog:bevy_input::axis::Axis<bevy_input::gamepad::GamepadInput>
Description
Stores a connected gamepad's metadata such as the name and its [
GamepadButton] and [GamepadAxis].An entity with this component is spawned automatically after [
GamepadConnectionEvent] and updated by [gamepad_event_processing_system].See also [
GamepadSettings] for configuration.Examples
# use bevy_input::gamepad::{Gamepad, GamepadAxis, GamepadButton}; # use bevy_ecs::system::Query; # use bevy_ecs::name::Name; # fn gamepad_usage_system(gamepads: Query<(&Name, &Gamepad)>) { for (name, gamepad) in &gamepads { println!("{name}"); if gamepad.just_pressed(GamepadButton::North) { println!("{} just pressed North", name) } if let Some(left_stick_x) = gamepad.get(GamepadAxis::LeftStickX) { println!("left stick X: {}", left_stick_x) } } }
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| product_id | Returns the USB product ID as assigned by the [vendor], if available. [vendor]: Self::vendor_id |
| dpad | Returns the directional pad as a [`Vec2`]. |
| right_stick | Returns the right stick as a [`Vec2`]. |
| just_pressed | Returns `true` if the [`GamepadButton`] has been pressed during the current frame. Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`]... |
| just_released | Returns `true` if the [`GamepadButton`] has been released during the current frame. Note: This function does not imply information regarding the current state of [`ButtonInput::pressed`]... |
| pressed | Returns `true` if the [`GamepadButton`] has been pressed. |
| vendor_id | Returns the USB vendor ID as assigned by the USB-IF, if available. |
| left_stick | Returns the left stick as a [`Vec2`]. |
product_id
Returns the USB product ID as assigned by the [vendor], if available. [vendor]: Self::vendor_id
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Gamepad | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<u16> | No Documentation 🚧 |
dpad
Returns the directional pad as a [
Vec2].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Gamepad | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
right_stick
Returns the right stick as a [
Vec2].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Gamepad | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
just_pressed
Returns
trueif the [GamepadButton] has been pressed during the current frame. Note: This function does not imply information regarding the current state of [ButtonInput::pressed] or [ButtonInput::just_released].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Gamepad | No Documentation 🚧 |
| button_type | GamepadButton | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
just_released
Returns
trueif the [GamepadButton] has been released during the current frame. Note: This function does not imply information regarding the current state of [ButtonInput::pressed] or [ButtonInput::just_pressed].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Gamepad | No Documentation 🚧 |
| button_type | GamepadButton | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
pressed
Returns
trueif the [GamepadButton] has been pressed.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Gamepad | No Documentation 🚧 |
| button_type | GamepadButton | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
vendor_id
Returns the USB vendor ID as assigned by the USB-IF, if available.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Gamepad | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<u16> | No Documentation 🚧 |
left_stick
Returns the left stick as a [
Vec2].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Gamepad | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
GamepadAxis
LeftStickX
LeftStickY
LeftZ
RightStickX
RightStickY
RightZ
Other
- u8
Description
Represents gamepad input types that are mapped in the range [-1.0, 1.0].
Usage
This is used to determine which axis has changed its value when receiving a gamepad axis event. It is also used in the [
Gamepad] component.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadAxis | No Documentation 🚧 |
| other | GamepadAxis | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadAxis | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadAxis | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadAxis | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
GamepadAxisChangedEvent
GamepadAxisChangedEvent
- entity:bevy_ecs::entity::Entity
- axis:bevy_input::gamepad::GamepadAxis
- value:f32
Description
[
GamepadAxis] event triggered by an analog state change.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| new | Creates a new [`GamepadAxisChangedEvent`]. |
| eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadAxisChangedEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadAxisChangedEvent | No Documentation 🚧 |
new
Creates a new [
GamepadAxisChangedEvent].
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | No Documentation 🚧 |
| axis | GamepadAxis | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadAxisChangedEvent | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadAxisChangedEvent | No Documentation 🚧 |
| other | GamepadAxisChangedEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
GamepadButton
South
East
North
West
C
Z
LeftTrigger
LeftTrigger2
RightTrigger
RightTrigger2
Select
Start
Mode
LeftThumb
RightThumb
DPadUp
DPadDown
DPadLeft
DPadRight
Other
- u8
Description
Represents gamepad input types that are mapped in the range [0.0, 1.0].
Usage
This is used to determine which button has changed its value when receiving gamepad button events. It is also used in the [
Gamepad] component.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadButton | No Documentation 🚧 |
| other | GamepadButton | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadButton | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadButton | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadButton | No Documentation 🚧 |
GamepadButtonChangedEvent
GamepadButtonChangedEvent
- entity:bevy_ecs::entity::Entity
- button:bevy_input::gamepad::GamepadButton
- state:bevy_input::ButtonState
- value:f32
Description
[
GamepadButton] event triggered by an analog state change.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| new | Creates a new [`GamepadButtonChangedEvent`]. |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadButtonChangedEvent | No Documentation 🚧 |
| other | GamepadButtonChangedEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadButtonChangedEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadButtonChangedEvent | No Documentation 🚧 |
new
Creates a new [
GamepadButtonChangedEvent].
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | No Documentation 🚧 |
| button | GamepadButton | No Documentation 🚧 |
| state | ButtonState | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadButtonChangedEvent | No Documentation 🚧 |
GamepadButtonStateChangedEvent
GamepadButtonStateChangedEvent
- entity:bevy_ecs::entity::Entity
- button:bevy_input::gamepad::GamepadButton
- state:bevy_input::ButtonState
Description
[
GamepadButton] event triggered by a digital state change.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| new | Creates a new [`GamepadButtonStateChangedEvent`]. |
| eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadButtonStateChangedEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadButtonStateChangedEvent | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadButtonStateChangedEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
new
Creates a new [
GamepadButtonStateChangedEvent].
Arguments
| Name | Type | Documentation |
|---|---|---|
| entity | Entity | No Documentation 🚧 |
| button | GamepadButton | No Documentation 🚧 |
| state | ButtonState | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadButtonStateChangedEvent | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadButtonStateChangedEvent | No Documentation 🚧 |
| other | GamepadButtonStateChangedEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
GamepadConnection
Connected
- name:String
- vendor_id:core::option::Option
- product_id:core::option::Option
Disconnected
Description
The connection status of a gamepad.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadConnection | No Documentation 🚧 |
| other | GamepadConnection | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadConnection | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadConnection | No Documentation 🚧 |
GamepadConnectionEvent
GamepadConnectionEvent
- gamepad:bevy_ecs::entity::Entity
- connection:bevy_input::gamepad::GamepadConnection
Description
A Gamepad connection event. Created when a connection to a gamepad is established and when a gamepad is disconnected.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates a [`GamepadConnectionEvent`]. |
| eq | No Documentation 🚧 |
| connected | Whether the gamepad is connected. |
| clone | No Documentation 🚧 |
| disconnected | Whether the gamepad is disconnected. |
new
Creates a [
GamepadConnectionEvent].
Arguments
| Name | Type | Documentation |
|---|---|---|
| gamepad | Entity | No Documentation 🚧 |
| connection | GamepadConnection | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadConnectionEvent | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadConnectionEvent | No Documentation 🚧 |
| other | GamepadConnectionEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
connected
Whether the gamepad is connected.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadConnectionEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadConnectionEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadConnectionEvent | No Documentation 🚧 |
disconnected
Whether the gamepad is disconnected.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadConnectionEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
GamepadEvent
Connection
- bevy_input::gamepad::GamepadConnectionEvent
Button
- bevy_input::gamepad::GamepadButtonChangedEvent
Axis
- bevy_input::gamepad::GamepadAxisChangedEvent
Description
A gamepad event.
This event type is used over the [
GamepadConnectionEvent], [GamepadButtonChangedEvent] and [GamepadAxisChangedEvent] when the in-frame relative ordering of events is important.This event is produced by
bevy_input.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadEvent | No Documentation 🚧 |
| other | GamepadEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadEvent | No Documentation 🚧 |
GamepadInput
Axis
- bevy_input::gamepad::GamepadAxis
Button
- bevy_input::gamepad::GamepadButton
Description
Encapsulation over [
GamepadAxis] and [GamepadButton].
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadInput | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadInput | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadInput | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadInput | No Documentation 🚧 |
| other | GamepadInput | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
GamepadRumbleIntensity
GamepadRumbleIntensity
- strong_motor:f32
- weak_motor:f32
Description
The intensity at which a gamepad's force-feedback motors may rumble.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| weak_motor | Creates a new rumble intensity with weak motor intensity set to the given value. Clamped within th... |
| clone | No Documentation 🚧 |
| strong_motor | Creates a new rumble intensity with strong motor intensity set to the given value. Clamped within ... |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadRumbleIntensity | No Documentation 🚧 |
| other | GamepadRumbleIntensity | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
weak_motor
Creates a new rumble intensity with weak motor intensity set to the given value. Clamped within the
0.0to1.0range.
Arguments
| Name | Type | Documentation |
|---|---|---|
| intensity | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadRumbleIntensity | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadRumbleIntensity | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadRumbleIntensity | No Documentation 🚧 |
strong_motor
Creates a new rumble intensity with strong motor intensity set to the given value. Clamped within the
0.0to1.0range.
Arguments
| Name | Type | Documentation |
|---|---|---|
| intensity | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadRumbleIntensity | No Documentation 🚧 |
GamepadRumbleRequest
Add
- duration:core::time::Duration
- intensity:bevy_input::gamepad::GamepadRumbleIntensity
- gamepad:bevy_ecs::entity::Entity
Stop
- gamepad:bevy_ecs::entity::Entity
Description
An event that controls force-feedback rumbling of a [
Gamepad]entity.Notes
Does nothing if the gamepad or platform does not support rumble.
Example
# use bevy_input::gamepad::{Gamepad, GamepadRumbleRequest, GamepadRumbleIntensity}; # use bevy_ecs::prelude::{EventWriter, Res, Query, Entity, With}; # use core::time::Duration; fn rumble_gamepad_system( mut rumble_requests: EventWriter<GamepadRumbleRequest>, gamepads: Query<Entity, With<Gamepad>>, ) { for entity in gamepads.iter() { rumble_requests.write(GamepadRumbleRequest::Add { gamepad: entity, intensity: GamepadRumbleIntensity::MAX, duration: Duration::from_secs_f32(0.5), }); } }
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadRumbleRequest | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadRumbleRequest | No Documentation 🚧 |
gamepad
Get the [
Entity] associated with this request.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadRumbleRequest | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Entity | No Documentation 🚧 |
GamepadSettings
GamepadSettings
- default_button_settings:bevy_input::gamepad::ButtonSettings
- default_axis_settings:bevy_input::gamepad::AxisSettings
- default_button_axis_settings:bevy_input::gamepad::ButtonAxisSettings
- button_settings:bevy_platform::collections::HashMap<bevy_input::gamepad::GamepadButton, bevy_input::gamepad::ButtonSettings, bevy_platform::hash::FixedHasher>
- axis_settings:bevy_platform::collections::HashMap<bevy_input::gamepad::GamepadAxis, bevy_input::gamepad::AxisSettings, bevy_platform::hash::FixedHasher>
- button_axis_settings:bevy_platform::collections::HashMap<bevy_input::gamepad::GamepadButton, bevy_input::gamepad::ButtonAxisSettings, bevy_platform::hash::FixedHasher>
Description
Gamepad settings component.
Usage
It is used to create a
bevycomponent that stores the settings of [GamepadButton] and [GamepadAxis] in [Gamepad]. If no user defined [ButtonSettings], [AxisSettings], or [ButtonAxisSettings] are defined, the default settings of each are used as a fallback accordingly.Note
The [
GamepadSettings] are used to determine when raw gamepad events should register. Events that don't meet the change thresholds defined in [GamepadSettings] will not register. To modify these settings, mutate the corresponding component.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GamepadSettings | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GamepadSettings | No Documentation 🚧 |
RawGamepadAxisChangedEvent
RawGamepadAxisChangedEvent
- gamepad:bevy_ecs::entity::Entity
- axis:bevy_input::gamepad::GamepadAxis
- value:f32
Description
[
GamepadAxis] changed event unfiltered by [GamepadSettings].
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| new | Creates a [`RawGamepadAxisChangedEvent`]. |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RawGamepadAxisChangedEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RawGamepadAxisChangedEvent | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RawGamepadAxisChangedEvent | No Documentation 🚧 |
| other | RawGamepadAxisChangedEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Creates a [
RawGamepadAxisChangedEvent].
Arguments
| Name | Type | Documentation |
|---|---|---|
| gamepad | Entity | No Documentation 🚧 |
| axis_type | GamepadAxis | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RawGamepadAxisChangedEvent | No Documentation 🚧 |
RawGamepadButtonChangedEvent
RawGamepadButtonChangedEvent
- gamepad:bevy_ecs::entity::Entity
- button:bevy_input::gamepad::GamepadButton
- value:f32
Description
[
GamepadButton] changed event unfiltered by [GamepadSettings].
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| new | Creates a [`RawGamepadButtonChangedEvent`]. |
| eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RawGamepadButtonChangedEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RawGamepadButtonChangedEvent | No Documentation 🚧 |
new
Creates a [
RawGamepadButtonChangedEvent].
Arguments
| Name | Type | Documentation |
|---|---|---|
| gamepad | Entity | No Documentation 🚧 |
| button_type | GamepadButton | No Documentation 🚧 |
| value | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RawGamepadButtonChangedEvent | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RawGamepadButtonChangedEvent | No Documentation 🚧 |
| other | RawGamepadButtonChangedEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
RawGamepadEvent
Connection
- bevy_input::gamepad::GamepadConnectionEvent
Button
- bevy_input::gamepad::RawGamepadButtonChangedEvent
Axis
- bevy_input::gamepad::RawGamepadAxisChangedEvent
Description
A raw gamepad event.
This event type is used over the [
GamepadConnectionEvent], [RawGamepadButtonChangedEvent] and [RawGamepadAxisChangedEvent] when the in-frame relative ordering of events is important.This event type is used by
bevy_inputto feed its components.
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RawGamepadEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RawGamepadEvent | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RawGamepadEvent | No Documentation 🚧 |
| other | RawGamepadEvent | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
DoubleTapGesture
DoubleTapGesture
Description
Double tap gesture.
Platform-specific
- Only available on
macOSandiOS.- On
iOS, must be enabled first
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DoubleTapGesture | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DoubleTapGesture | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DoubleTapGesture | No Documentation 🚧 |
| other | DoubleTapGesture | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
PanGesture
PanGesture
- glam::Vec2
Description
Pan gesture.
Platform-specific
- On
iOS, must be enabled first
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | PanGesture | No Documentation 🚧 |
| other | PanGesture | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | PanGesture | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | PanGesture | No Documentation 🚧 |
PinchGesture
PinchGesture
- f32
Description
Two-finger pinch gesture, often used for magnifications.
Positive delta values indicate magnification (zooming in) and negative delta values indicate shrinking (zooming out).
Platform-specific
- Only available on
macOSandiOS.- On
iOS, must be enabled first
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | PinchGesture | No Documentation 🚧 |
| other | PinchGesture | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | PinchGesture | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | PinchGesture | No Documentation 🚧 |
RotationGesture
RotationGesture
- f32
Description
Two-finger rotation gesture.
Positive delta values indicate rotation counterclockwise and negative delta values indicate rotation clockwise.
Platform-specific
- Only available on
macOSandiOS.- On
iOS, must be enabled first
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RotationGesture | No Documentation 🚧 |
| other | RotationGesture | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RotationGesture | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RotationGesture | No Documentation 🚧 |
Key
Character
- smol_str::SmolStr
Unidentified
- bevy_input::keyboard::NativeKey
Dead
- core::option::Option
Alt
AltGraph
CapsLock
Control
Fn
FnLock
NumLock
ScrollLock
Shift
Symbol
SymbolLock
Meta
Hyper
Super
Enter
Tab
Space
ArrowDown
ArrowLeft
ArrowRight
ArrowUp
End
Home
PageDown
PageUp
Backspace
Clear
Copy
CrSel
Cut
Delete
EraseEof
ExSel
Insert
Paste
Redo
Undo
Accept
Again
Attn
Cancel
ContextMenu
Escape
Execute
Find
Help
Pause
Play
Props
Select
ZoomIn
ZoomOut
BrightnessDown
BrightnessUp
Eject
LogOff
Power
PowerOff
PrintScreen
Hibernate
Standby
WakeUp
AllCandidates
Alphanumeric
CodeInput
Compose
Convert
FinalMode
GroupFirst
GroupLast
GroupNext
GroupPrevious
ModeChange
NextCandidate
NonConvert
PreviousCandidate
Process
SingleCandidate
HangulMode
HanjaMode
JunjaMode
Eisu
Hankaku
Hiragana
HiraganaKatakana
KanaMode
KanjiMode
Katakana
Romaji
Zenkaku
ZenkakuHankaku
Soft1
Soft2
Soft3
Soft4
ChannelDown
ChannelUp
Close
MailForward
MailReply
MailSend
MediaClose
MediaFastForward
MediaPause
MediaPlay
MediaPlayPause
MediaRecord
MediaRewind
MediaStop
MediaTrackNext
MediaTrackPrevious
New
Open
Save
SpellCheck
Key11
Key12
AudioBalanceLeft
AudioBalanceRight
AudioBassBoostDown
AudioBassBoostToggle
AudioBassBoostUp
AudioFaderFront
AudioFaderRear
AudioSurroundModeNext
AudioTrebleDown
AudioTrebleUp
AudioVolumeDown
AudioVolumeUp
AudioVolumeMute
MicrophoneToggle
MicrophoneVolumeDown
MicrophoneVolumeUp
MicrophoneVolumeMute
SpeechCorrectionList
SpeechInputToggle
LaunchApplication1
LaunchApplication2
LaunchCalendar
LaunchContacts
LaunchMail
LaunchMediaPlayer
LaunchMusicPlayer
LaunchPhone
LaunchScreenSaver
LaunchSpreadsheet
LaunchWebBrowser
LaunchWebCam
LaunchWordProcessor
BrowserBack
BrowserFavorites
BrowserForward
BrowserHome
BrowserRefresh
BrowserSearch
BrowserStop
AppSwitch
Call
Camera
CameraFocus
EndCall
GoBack
GoHome
HeadsetHook
LastNumberRedial
Notification
MannerMode
VoiceDial
TV
TV3DMode
TVAntennaCable
TVAudioDescription
TVAudioDescriptionMixDown
TVAudioDescriptionMixUp
TVContentsMenu
TVDataService
TVInput
TVInputComponent1
TVInputComponent2
TVInputComposite1
TVInputComposite2
TVInputHDMI1
TVInputHDMI2
TVInputHDMI3
TVInputHDMI4
TVInputVGA1
TVMediaContext
TVNetwork
TVNumberEntry
TVPower
TVRadioService
TVSatellite
TVSatelliteBS
TVSatelliteCS
TVSatelliteToggle
TVTerrestrialAnalog
TVTerrestrialDigital
TVTimer
AVRInput
AVRPower
ColorF0Red
ColorF1Green
ColorF2Yellow
ColorF3Blue
ColorF4Grey
ColorF5Brown
ClosedCaptionToggle
Dimmer
DisplaySwap
DVR
Exit
FavoriteClear0
FavoriteClear1
FavoriteClear2
FavoriteClear3
FavoriteRecall0
FavoriteRecall1
FavoriteRecall2
FavoriteRecall3
FavoriteStore0
FavoriteStore1
FavoriteStore2
FavoriteStore3
Guide
GuideNextDay
GuidePreviousDay
Info
InstantReplay
Link
ListProgram
LiveContent
Lock
MediaApps
MediaAudioTrack
MediaLast
MediaSkipBackward
MediaSkipForward
MediaStepBackward
MediaStepForward
MediaTopMenu
NavigateIn
NavigateNext
NavigateOut
NavigatePrevious
NextFavoriteChannel
NextUserProfile
OnDemand
Pairing
PinPDown
PinPMove
PinPToggle
PinPUp
PlaySpeedDown
PlaySpeedReset
PlaySpeedUp
RandomToggle
RcLowBattery
RecordSpeedNext
RfBypass
ScanChannelsToggle
ScreenModeNext
Settings
SplitScreenToggle
STBInput
STBPower
Subtitle
Teletext
VideoModeNext
Wink
ZoomToggle
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
F13
F14
F15
F16
F17
F18
F19
F20
F21
F22
F23
F24
F25
F26
F27
F28
F29
F30
F31
F32
F33
F34
F35
Description
The logical key code of a [
KeyboardInput].Technical
Its values map 1 to 1 to winit's Key.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Key | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Key | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Key | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
KeyCode
Unidentified
- bevy_input::keyboard::NativeKeyCode
Backquote
Backslash
BracketLeft
BracketRight
Comma
Digit0
Digit1
Digit2
Digit3
Digit4
Digit5
Digit6
Digit7
Digit8
Digit9
Equal
IntlBackslash
IntlRo
IntlYen
KeyA
KeyB
KeyC
KeyD
KeyE
KeyF
KeyG
KeyH
KeyI
KeyJ
KeyK
KeyL
KeyM
KeyN
KeyO
KeyP
KeyQ
KeyR
KeyS
KeyT
KeyU
KeyV
KeyW
KeyX
KeyY
KeyZ
Minus
Period
Quote
Semicolon
Slash
AltLeft
AltRight
Backspace
CapsLock
ContextMenu
ControlLeft
ControlRight
Enter
SuperLeft
SuperRight
ShiftLeft
ShiftRight
Space
Tab
Convert
KanaMode
Lang1
Lang2
Lang3
Lang4
Lang5
NonConvert
Delete
End
Help
Home
Insert
PageDown
PageUp
ArrowDown
ArrowLeft
ArrowRight
ArrowUp
NumLock
Numpad0
Numpad1
Numpad2
Numpad3
Numpad4
Numpad5
Numpad6
Numpad7
Numpad8
Numpad9
NumpadAdd
NumpadBackspace
NumpadClear
NumpadClearEntry
NumpadComma
NumpadDecimal
NumpadDivide
NumpadEnter
NumpadEqual
NumpadHash
NumpadMemoryAdd
NumpadMemoryClear
NumpadMemoryRecall
NumpadMemoryStore
NumpadMemorySubtract
NumpadMultiply
NumpadParenLeft
NumpadParenRight
NumpadStar
NumpadSubtract
Escape
Fn
FnLock
PrintScreen
ScrollLock
Pause
BrowserBack
BrowserFavorites
BrowserForward
BrowserHome
BrowserRefresh
BrowserSearch
BrowserStop
Eject
LaunchApp1
LaunchApp2
LaunchMail
MediaPlayPause
MediaSelect
MediaStop
MediaTrackNext
MediaTrackPrevious
Power
Sleep
AudioVolumeDown
AudioVolumeMute
AudioVolumeUp
WakeUp
Meta
Hyper
Turbo
Abort
Resume
Suspend
Again
Copy
Cut
Find
Open
Paste
Props
Select
Undo
Hiragana
Katakana
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
F13
F14
F15
F16
F17
F18
F19
F20
F21
F22
F23
F24
F25
F26
F27
F28
F29
F30
F31
F32
F33
F34
F35
Description
The key code of a [
KeyboardInput].Usage
It is used as the generic
Tvalue of an [ButtonInput] to create aRes<ButtonInput<KeyCode>>.Code representing the location of a physical key This mostly conforms to the UI Events Specification's
KeyboardEvent.codewith a few exceptions:
- The keys that the specification calls
MetaLeftandMetaRightare namedSuperLeftandSuperRighthere.- The key that the specification calls "Super" is reported as
Unidentifiedhere.Updating
The resource is updated inside of the [
keyboard_input_system].
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | KeyCode | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | KeyCode | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | KeyCode | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
KeyboardFocusLost
KeyboardFocusLost
Description
Gets generated from
bevy_winit::winit_runnerUsed for clearing all cached states to avoid having 'stuck' key presses when, for example, switching between windows with 'Alt-Tab' or using any other OS specific key combination that leads to Bevy window losing focus and not receiving any input events
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | KeyboardFocusLost | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | KeyboardFocusLost | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | KeyboardFocusLost | No Documentation 🚧 |
| other | KeyboardFocusLost | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | KeyboardFocusLost | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
KeyboardInput
KeyboardInput
- key_code:bevy_input::keyboard::KeyCode
- logical_key:bevy_input::keyboard::Key
- state:bevy_input::ButtonState
- text:core::option::Option<smol_str::SmolStr>
- repeat:bool
- window:bevy_ecs::entity::Entity
Description
A keyboard input event.
This event is the translated version of the
WindowEvent::KeyboardInputfrom thewinitcrate. It is available to the end user and can be used for game logic.Usage
The event is consumed inside of the [
keyboard_input_system] to update theButtonInput<KeyCode>resource.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | KeyboardInput | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | KeyboardInput | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | KeyboardInput | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | KeyboardInput | No Documentation 🚧 |
| other | KeyboardInput | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
NativeKey
Unidentified
Android
- u32
MacOS
- u16
Windows
- u16
Xkb
- u32
Web
- smol_str::SmolStr
Description
Contains the platform-native logical key identifier, known as keysym.
Exactly what that means differs from platform to platform, but the values are to some degree tied to the currently active keyboard layout. The same key on the same keyboard may also report different values on different platforms, which is one of the reasons this is a per-platform enum.
This enum is primarily used to store raw keysym when Winit doesn't map a given native logical key identifier to a meaningful [
Key] variant. This lets you use [Key], and let the user define keybinds which work in the presence of identifiers we haven't mapped for you yet.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | NativeKey | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | NativeKey | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | NativeKey | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
NativeKeyCode
Unidentified
Android
- u32
MacOS
- u16
Windows
- u16
Xkb
- u32
Description
Contains the platform-native physical key identifier
The exact values vary from platform to platform (which is part of why this is a per-platform enum), but the values are primarily tied to the key's physical location on the keyboard.
This enum is primarily used to store raw keycodes when Winit doesn't map a given native physical key identifier to a meaningful [
KeyCode] variant. In the presence of identifiers we haven't mapped for you yet, this lets you use [KeyCode] to:
- Correctly match key press and release events.
- On non-web platforms, support assigning keybinds to virtually any key through a UI.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | NativeKeyCode | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | NativeKeyCode | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | NativeKeyCode | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | NativeKeyCode | No Documentation 🚧 |
| other | NativeKeyCode | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
AccumulatedMouseMotion
AccumulatedMouseMotion
- delta:glam::Vec2
Description
Tracks how much the mouse has moved every frame.
This resource is reset to zero every frame.
This resource sums the total [
MouseMotion] events received this frame.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AccumulatedMouseMotion | No Documentation 🚧 |
| other | AccumulatedMouseMotion | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AccumulatedMouseMotion | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AccumulatedMouseMotion | No Documentation 🚧 |
AccumulatedMouseScroll
AccumulatedMouseScroll
- unit:bevy_input::mouse::MouseScrollUnit
- delta:glam::Vec2
Description
Tracks how much the mouse has scrolled every frame.
This resource is reset to zero every frame.
This resource sums the total [
MouseWheel] events received this frame.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AccumulatedMouseScroll | No Documentation 🚧 |
| other | AccumulatedMouseScroll | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AccumulatedMouseScroll | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AccumulatedMouseScroll | No Documentation 🚧 |
MouseButton
Left
Right
Middle
Back
Forward
Other
- u16
Description
A button on a mouse device.
Usage
It is used as the generic
Tvalue of an [ButtonInput] to create abevyresource.Updating
The resource is updated inside of the [
mouse_button_input_system].
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseButton | No Documentation 🚧 |
| other | MouseButton | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseButton | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseButton | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | MouseButton | No Documentation 🚧 |
MouseButtonInput
MouseButtonInput
- button:bevy_input::mouse::MouseButton
- state:bevy_input::ButtonState
- window:bevy_ecs::entity::Entity
Description
A mouse button input event.
This event is the translated version of the
WindowEvent::MouseInputfrom thewinitcrate.Usage
The event is read inside of the [
mouse_button_input_system] to update the [ButtonInput<MouseButton>] resource.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseButtonInput | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | MouseButtonInput | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseButtonInput | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseButtonInput | No Documentation 🚧 |
| other | MouseButtonInput | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
MouseMotion
MouseMotion
- delta:glam::Vec2
Description
An event reporting the change in physical position of a pointing device.
This represents raw, unfiltered physical motion. It is the translated version of
DeviceEvent::MouseMotionfrom thewinitcrate.All pointing devices connected to a single machine at the same time can emit the event independently. However, the event data does not make it possible to distinguish which device it is referring to.
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseMotion | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | MouseMotion | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseMotion | No Documentation 🚧 |
| other | MouseMotion | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
MouseScrollUnit
Line
Pixel
Description
The scroll unit.
Describes how a value of a [
MouseWheel] event has to be interpreted.The value of the event can either be interpreted as the amount of lines or the amount of pixels to scroll.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseScrollUnit | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseScrollUnit | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | MouseScrollUnit | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseScrollUnit | No Documentation 🚧 |
| other | MouseScrollUnit | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
MouseWheel
MouseWheel
- unit:bevy_input::mouse::MouseScrollUnit
- x:f32
- y:f32
- window:bevy_ecs::entity::Entity
Description
A mouse wheel event.
This event is the translated version of the
WindowEvent::MouseWheelfrom thewinitcrate.
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseWheel | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | MouseWheel | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | MouseWheel | No Documentation 🚧 |
| other | MouseWheel | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
ForceTouch
Calibrated
- force:f64
- max_possible_force:f64
- altitude_angle:core::option::Option
Normalized
- f64
Description
A force description of a [
Touch] input.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ForceTouch | No Documentation 🚧 |
| other | ForceTouch | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ForceTouch | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | ForceTouch | No Documentation 🚧 |
TouchInput
TouchInput
- phase:bevy_input::touch::TouchPhase
- position:glam::Vec2
- window:bevy_ecs::entity::Entity
- force:core::option::Option<bevy_input::touch::ForceTouch>
- id:u64
Description
A touch input event.
Logic
Every time the user touches the screen, a new [
TouchPhase::Started] event with an unique identifier for the finger is generated. When the finger is lifted, the [TouchPhase::Ended] event is generated with the same finger id.After a [
TouchPhase::Started] event has been emitted, there may be zero or more [TouchPhase::Moved] events when the finger is moved or the touch pressure changes.The finger id may be reused by the system after an [
TouchPhase::Ended] event. The user should assume that a new [TouchPhase::Started] event received with the same id has nothing to do with the old finger and is a new finger.A [
TouchPhase::Canceled] event is emitted when the system has canceled tracking this touch, such as when the window loses focus, or on iOS if the user moves the device against their face.Note
This event is the translated version of the
WindowEvent::Touchfrom thewinitcrate. It is available to the end user and can be used for game logic.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | TouchInput | No Documentation 🚧 |
| other | TouchInput | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | TouchInput | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | TouchInput | No Documentation 🚧 |
TouchPhase
Started
Moved
Ended
Canceled
Description
A phase of a [
TouchInput].Usage
It is used to describe the phase of the touch input that is currently active. This includes a phase that indicates that a touch input has started or ended, or that a finger has moved. There is also a canceled phase that indicates that the system canceled the tracking of the finger.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | TouchPhase | No Documentation 🚧 |
| other | TouchPhase | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | TouchPhase | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | TouchPhase | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | TouchPhase | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
AspectRatio
AspectRatio
- f32
Description
An
AspectRatiois the ratio of width to height.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| inverse | Returns the inverse of this aspect ratio (height/width). |
| clone | No Documentation 🚧 |
| is_square | Returns true if the aspect ratio is exactly square. |
| is_portrait | Returns true if the aspect ratio represents a portrait orientation. |
| ratio | Returns the aspect ratio as a f32 value. |
| eq | No Documentation 🚧 |
| is_landscape | Returns true if the aspect ratio represents a landscape orientation. |
inverse
Returns the inverse of this aspect ratio (height/width).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AspectRatio | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AspectRatio | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AspectRatio | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AspectRatio | No Documentation 🚧 |
is_square
Returns true if the aspect ratio is exactly square.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AspectRatio | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_portrait
Returns true if the aspect ratio represents a portrait orientation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AspectRatio | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
ratio
Returns the aspect ratio as a f32 value.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AspectRatio | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AspectRatio | No Documentation 🚧 |
| other | AspectRatio | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_landscape
Returns true if the aspect ratio represents a landscape orientation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AspectRatio | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
Aabb2d
Aabb2d
- min:glam::Vec2
- max:glam::Vec2
Description
A 2D axis-aligned bounding box, or bounding rectangle
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| closest_point | Finds the point on the AABB that is closest to the given `point`. If the point is outside the AABB... |
| clone | No Documentation 🚧 |
| new | Constructs an AABB from its center and half-size. |
| bounding_circle | Computes the smallest [`BoundingCircle`] containing this [`Aabb2d`]. |
| eq | No Documentation 🚧 |
closest_point
Finds the point on the AABB that is closest to the given
point. If the point is outside the AABB, the returned point will be on the perimeter of the AABB. Otherwise, it will be inside the AABB and returned as is.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Aabb2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Aabb2d | No Documentation 🚧 |
new
Constructs an AABB from its center and half-size.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Aabb2d | No Documentation 🚧 |
bounding_circle
Computes the smallest [
BoundingCircle] containing this [Aabb2d].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Aabb2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BoundingCircle | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
BoundingCircle
BoundingCircle
- center:glam::Vec2
- circle:bevy_math::primitives::dim2::Circle
Description
A bounding circle
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Constructs a bounding circle from its center and radius. |
| closest_point | Finds the point on the bounding circle that is closest to the given `point`. If the point is outsi... |
| radius | Get the radius of the bounding circle |
| aabb_2d | Computes the smallest [`Aabb2d`] containing this [`BoundingCircle`]. |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
new
Constructs a bounding circle from its center and radius.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BoundingCircle | No Documentation 🚧 |
closest_point
Finds the point on the bounding circle that is closest to the given
point. If the point is outside the circle, the returned point will be on the perimeter of the circle. Otherwise, it will be inside the circle and returned as is.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingCircle | No Documentation 🚧 |
| point | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
radius
Get the radius of the bounding circle
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingCircle | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
aabb_2d
Computes the smallest [
Aabb2d] containing this [BoundingCircle].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingCircle | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Aabb2d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingCircle | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BoundingCircle | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingCircle | No Documentation 🚧 |
| other | BoundingCircle | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
Aabb3d
Aabb3d
- min:glam::Vec3A
- max:glam::Vec3A
Description
A 3D axis-aligned bounding box
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| bounding_sphere | Computes the smallest [`BoundingSphere`] containing this [`Aabb3d`]. |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Aabb3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Aabb3d | No Documentation 🚧 |
bounding_sphere
Computes the smallest [
BoundingSphere] containing this [Aabb3d].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Aabb3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BoundingSphere | No Documentation 🚧 |
BoundingSphere
BoundingSphere
- center:glam::Vec3A
- sphere:bevy_math::primitives::dim3::Sphere
Description
A bounding sphere
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| radius | Get the radius of the bounding sphere |
| aabb_3d | Computes the smallest [`Aabb3d`] containing this [`BoundingSphere`]. |
| eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingSphere | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BoundingSphere | No Documentation 🚧 |
radius
Get the radius of the bounding sphere
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingSphere | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
aabb_3d
Computes the smallest [
Aabb3d] containing this [BoundingSphere].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingSphere | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Aabb3d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingSphere | No Documentation 🚧 |
| other | BoundingSphere | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
AabbCast2d
AabbCast2d
- ray:bevy_math::bounding::raycast2d::RayCast2d
- aabb:bevy_math::bounding::bounded2d::Aabb2d
Description
An intersection test that casts an [
Aabb2d] along a ray.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| aabb_collision_at | Get the distance at which the [`Aabb2d`]s collide, if at all. |
| from_ray | Construct an [`AabbCast2d`] from an [`Aabb2d`], [`Ray2d`], and max distance. |
| new | Construct an [`AabbCast2d`] from an [`Aabb2d`], origin, [`Dir2`], and max distance. |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AabbCast2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AabbCast2d | No Documentation 🚧 |
aabb_collision_at
Get the distance at which the [
Aabb2d]s collide, if at all.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AabbCast2d | No Documentation 🚧 |
| aabb | Aabb2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<f32> | No Documentation 🚧 |
from_ray
Construct an [
AabbCast2d] from an [Aabb2d], [Ray2d], and max distance.
Arguments
| Name | Type | Documentation |
|---|---|---|
| aabb | Aabb2d | No Documentation 🚧 |
| ray | Ray2d | No Documentation 🚧 |
| max | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AabbCast2d | No Documentation 🚧 |
new
Construct an [
AabbCast2d] from an [Aabb2d], origin, [Dir2], and max distance.
Arguments
| Name | Type | Documentation |
|---|---|---|
| aabb | Aabb2d | No Documentation 🚧 |
| origin | Vec2 | No Documentation 🚧 |
| direction | Dir2 | No Documentation 🚧 |
| max | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AabbCast2d | No Documentation 🚧 |
BoundingCircleCast
BoundingCircleCast
- ray:bevy_math::bounding::raycast2d::RayCast2d
- circle:bevy_math::bounding::bounded2d::BoundingCircle
Description
An intersection test that casts a [
BoundingCircle] along a ray.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], origin, [`Dir2`], and max distance. |
| circle_collision_at | Get the distance at which the [`BoundingCircle`]s collide, if at all. |
| clone | No Documentation 🚧 |
| from_ray | Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], [`Ray2d`], and max distance. |
new
Construct a [
BoundingCircleCast] from a [BoundingCircle], origin, [Dir2], and max distance.
Arguments
| Name | Type | Documentation |
|---|---|---|
| circle | BoundingCircle | No Documentation 🚧 |
| origin | Vec2 | No Documentation 🚧 |
| direction | Dir2 | No Documentation 🚧 |
| max | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BoundingCircleCast | No Documentation 🚧 |
circle_collision_at
Get the distance at which the [
BoundingCircle]s collide, if at all.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingCircleCast | No Documentation 🚧 |
| circle | BoundingCircle | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<f32> | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingCircleCast | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BoundingCircleCast | No Documentation 🚧 |
from_ray
Construct a [
BoundingCircleCast] from a [BoundingCircle], [Ray2d], and max distance.
Arguments
| Name | Type | Documentation |
|---|---|---|
| circle | BoundingCircle | No Documentation 🚧 |
| ray | Ray2d | No Documentation 🚧 |
| max | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BoundingCircleCast | No Documentation 🚧 |
RayCast2d
RayCast2d
- ray:bevy_math::ray::Ray2d
- max:f32
- direction_recip:glam::Vec2
Description
A raycast intersection test for 2D bounding volumes
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| from_ray | Construct a [`RayCast2d`] from a [`Ray2d`] and max distance. |
| circle_intersection_at | Get the distance of an intersection with a [`BoundingCircle`], if any. |
| aabb_intersection_at | Get the distance of an intersection with an [`Aabb2d`], if any. |
| new | Construct a [`RayCast2d`] from an origin, [`Dir2`], and max distance. |
| direction_recip | Get the cached multiplicative inverse of the direction of the ray. |
| clone | No Documentation 🚧 |
from_ray
Construct a [
RayCast2d] from a [Ray2d] and max distance.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RayCast2d | No Documentation 🚧 |
circle_intersection_at
Get the distance of an intersection with a [
BoundingCircle], if any.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RayCast2d | No Documentation 🚧 |
| circle | BoundingCircle | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<f32> | No Documentation 🚧 |
aabb_intersection_at
Get the distance of an intersection with an [
Aabb2d], if any.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<f32> | No Documentation 🚧 |
new
Construct a [
RayCast2d] from an origin, [Dir2], and max distance.
Arguments
| Name | Type | Documentation |
|---|---|---|
| origin | Vec2 | No Documentation 🚧 |
| direction | Dir2 | No Documentation 🚧 |
| max | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RayCast2d | No Documentation 🚧 |
direction_recip
Get the cached multiplicative inverse of the direction of the ray.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RayCast2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RayCast2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RayCast2d | No Documentation 🚧 |
AabbCast3d
AabbCast3d
- ray:bevy_math::bounding::raycast3d::RayCast3d
- aabb:bevy_math::bounding::bounded3d::Aabb3d
Description
An intersection test that casts an [
Aabb3d] along a ray.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| from_ray | Construct an [`AabbCast3d`] from an [`Aabb3d`], [`Ray3d`], and max distance. |
| aabb_collision_at | Get the distance at which the [`Aabb3d`]s collide, if at all. |
| clone | No Documentation 🚧 |
from_ray
Construct an [
AabbCast3d] from an [Aabb3d], [Ray3d], and max distance.
Arguments
| Name | Type | Documentation |
|---|---|---|
| aabb | Aabb3d | No Documentation 🚧 |
| ray | Ray3d | No Documentation 🚧 |
| max | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AabbCast3d | No Documentation 🚧 |
aabb_collision_at
Get the distance at which the [
Aabb3d]s collide, if at all.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AabbCast3d | No Documentation 🚧 |
| aabb | Aabb3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<f32> | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AabbCast3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AabbCast3d | No Documentation 🚧 |
BoundingSphereCast
BoundingSphereCast
- ray:bevy_math::bounding::raycast3d::RayCast3d
- sphere:bevy_math::bounding::bounded3d::BoundingSphere
Description
An intersection test that casts a [
BoundingSphere] along a ray.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| sphere_collision_at | Get the distance at which the [`BoundingSphere`]s collide, if at all. |
| from_ray | Construct a [`BoundingSphereCast`] from a [`BoundingSphere`], [`Ray3d`], and max distance. |
| clone | No Documentation 🚧 |
sphere_collision_at
Get the distance at which the [
BoundingSphere]s collide, if at all.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingSphereCast | No Documentation 🚧 |
| sphere | BoundingSphere | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<f32> | No Documentation 🚧 |
from_ray
Construct a [
BoundingSphereCast] from a [BoundingSphere], [Ray3d], and max distance.
Arguments
| Name | Type | Documentation |
|---|---|---|
| sphere | BoundingSphere | No Documentation 🚧 |
| ray | Ray3d | No Documentation 🚧 |
| max | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BoundingSphereCast | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BoundingSphereCast | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BoundingSphereCast | No Documentation 🚧 |
RayCast3d
RayCast3d
- origin:glam::Vec3A
- direction:bevy_math::direction::Dir3A
- max:f32
- direction_recip:glam::Vec3A
Description
A raycast intersection test for 3D bounding volumes
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| aabb_intersection_at | Get the distance of an intersection with an [`Aabb3d`], if any. |
| clone | No Documentation 🚧 |
| from_ray | Construct a [`RayCast3d`] from a [`Ray3d`] and max distance. |
| direction_recip | Get the cached multiplicative inverse of the direction of the ray. |
| sphere_intersection_at | Get the distance of an intersection with a [`BoundingSphere`], if any. |
aabb_intersection_at
Get the distance of an intersection with an [
Aabb3d], if any.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<f32> | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RayCast3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RayCast3d | No Documentation 🚧 |
from_ray
Construct a [
RayCast3d] from a [Ray3d] and max distance.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RayCast3d | No Documentation 🚧 |
direction_recip
Get the cached multiplicative inverse of the direction of the ray.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RayCast3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
sphere_intersection_at
Get the distance of an intersection with a [
BoundingSphere], if any.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RayCast3d | No Documentation 🚧 |
| sphere | BoundingSphere | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<f32> | No Documentation 🚧 |
CompassOctant
North
NorthEast
East
SouthEast
South
SouthWest
West
NorthWest
Description
A compass enum with 8 directions.
N (North) ▲ NW │ NE ╲ │ ╱ W (West) ┼─────► E (East) ╱ │ ╲ SW │ SE ▼ S (South)
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| neg | No Documentation 🚧 |
| to_index | Converts a [`CompassOctant`] to a standard index. Starts at 0 for [`CompassOctant::North`] and inc... |
| opposite | Returns the opposite [`CompassOctant`], located 180 degrees from `self`. This can also be accessed via the `-` operator, using the [`Neg`]... |
| eq | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CompassOctant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CompassOctant | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CompassOctant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CompassOctant | No Documentation 🚧 |
to_index
Converts a [
CompassOctant] to a standard index. Starts at 0 for [CompassOctant::North] and increments clockwise.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CompassOctant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | usize | No Documentation 🚧 |
opposite
Returns the opposite [
CompassOctant], located 180 degrees fromself. This can also be accessed via the-operator, using the [Neg] trait.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CompassOctant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CompassOctant | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CompassOctant | No Documentation 🚧 |
| other | CompassOctant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CompassOctant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
CompassQuadrant
North
East
South
West
Description
A compass enum with 4 directions.
N (North) ▲ │ │ W (West) ┼─────► E (East) │ │ ▼ S (South)
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| neg | No Documentation 🚧 |
| to_index | Converts a [`CompassQuadrant`] to a standard index. Starts at 0 for [`CompassQuadrant::North`] and... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| opposite | Returns the opposite [`CompassQuadrant`], located 180 degrees from `self`. This can also be accessed via the `-` operator, using the [`Neg`]... |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CompassQuadrant | No Documentation 🚧 |
| other | CompassQuadrant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CompassQuadrant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CompassQuadrant | No Documentation 🚧 |
to_index
Converts a [
CompassQuadrant] to a standard index. Starts at 0 for [CompassQuadrant::North] and increments clockwise.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CompassQuadrant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | usize | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CompassQuadrant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CompassQuadrant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CompassQuadrant | No Documentation 🚧 |
opposite
Returns the opposite [
CompassQuadrant], located 180 degrees fromself. This can also be accessed via the-operator, using the [Neg] trait.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CompassQuadrant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CompassQuadrant | No Documentation 🚧 |
EaseFunction
Linear
QuadraticIn
QuadraticOut
QuadraticInOut
CubicIn
CubicOut
CubicInOut
QuarticIn
QuarticOut
QuarticInOut
QuinticIn
QuinticOut
QuinticInOut
SmoothStepIn
SmoothStepOut
SmoothStep
SmootherStepIn
SmootherStepOut
SmootherStep
SineIn
SineOut
SineInOut
CircularIn
CircularOut
CircularInOut
ExponentialIn
ExponentialOut
ExponentialInOut
ElasticIn
ElasticOut
ElasticInOut
BackIn
BackOut
BackInOut
BounceIn
BounceOut
BounceInOut
Steps
- usize
- bevy_math::curve::easing::JumpAt
Elastic
- f32
Description
Curve functions over the unit interval, commonly used for easing transitions.
EaseFunctioncan be used on its own to interpolate between0.0and1.0. It can also be combined with [EasingCurve] to interpolate between other intervals and types, including vectors and rotations.Example
samplethe smoothstep function at various points. This will returnNoneif the parameter is outside the unit interval.# use bevy_math::prelude::*; let f = EaseFunction::SmoothStep; assert_eq!(f.sample(-1.0), None); assert_eq!(f.sample(0.0), Some(0.0)); assert_eq!(f.sample(0.5), Some(0.5)); assert_eq!(f.sample(1.0), Some(1.0)); assert_eq!(f.sample(2.0), None);
sample_clampedwill clamp the parameter to the unit interval, so it always returns a value.# use bevy_math::prelude::*; # let f = EaseFunction::SmoothStep; assert_eq!(f.sample_clamped(-1.0), 0.0); assert_eq!(f.sample_clamped(0.0), 0.0); assert_eq!(f.sample_clamped(0.5), 0.5); assert_eq!(f.sample_clamped(1.0), 1.0); assert_eq!(f.sample_clamped(2.0), 1.0);
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | EaseFunction | No Documentation 🚧 |
| other | EaseFunction | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | EaseFunction | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | EaseFunction | No Documentation 🚧 |
JumpAt
Start
End
None
Both
Description
Configuration options for the [
EaseFunction::Steps] curves. This closely replicates the CSS step function specification.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | JumpAt | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | JumpAt | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | JumpAt | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
Interval
Interval
- start:f32
- end:f32
Description
A nonempty closed interval, possibly unbounded in either direction.
In other words, the interval may stretch all the way to positive or negative infinity, but it will always have some nonempty interior.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clamp | Clamp the given `value` to lie within this interval. |
| contains_interval | Returns `true` if the other interval is contained in this interval. This is non-strict: each inter... |
| has_finite_start | Returns `true` if this interval has a finite start. |
| eq | No Documentation 🚧 |
| end | Get the end of this interval. |
| contains | Returns `true` if `item` is contained in this interval. |
| length | Get the length of this interval. Note that the result may be infinite (`f32::INFINITY`). |
| is_bounded | Returns `true` if this interval is bounded — that is, if both its start and end are finite. Equi... |
| has_finite_end | Returns `true` if this interval has a finite end. |
| start | Get the start of this interval. |
| clone | No Documentation 🚧 |
clamp
Clamp the given
valueto lie within this interval.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
contains_interval
Returns
trueif the other interval is contained in this interval. This is non-strict: each interval will contain itself.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
has_finite_start
Returns
trueif this interval has a finite start.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Interval | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
end
Get the end of this interval.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Interval | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
contains
Returns
trueifitemis contained in this interval.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
length
Get the length of this interval. Note that the result may be infinite (
f32::INFINITY).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Interval | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
is_bounded
Returns
trueif this interval is bounded — that is, if both its start and end are finite. Equivalently, an interval is bounded if its length is finite.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Interval | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
has_finite_end
Returns
trueif this interval has a finite end.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Interval | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
start
Get the start of this interval.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Interval | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Interval | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Interval | No Documentation 🚧 |
Dir2
Dir2
- glam::Vec2
Description
A normalized vector pointing in a direction in 2D space
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| slerp | Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`. This c... |
| new_unchecked | Create a [`Dir2`] from a [`Vec2`] that is already normalized. # Warning `value` must be normalize... |
| rotation_from_y | Get the rotation that rotates the Y-axis to this direction. |
| neg | No Documentation 🚧 |
| rotation_to_x | Get the rotation that rotates this direction to the X-axis. |
| rotation_to | Get the rotation that rotates this direction to `other`. |
| mul | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| rotation_to_y | Get the rotation that rotates this direction to the Y-axis. |
| fast_renormalize | Returns `self` after an approximate normalization, assuming the value is already nearly normalized.... |
| rotation_from | Get the rotation that rotates `other` to this direction. |
| as_vec2 | Returns the inner [`Vec2`] |
| rotation_from_x | Get the rotation that rotates the X-axis to this direction. |
| from_xy_unchecked | Create a direction from its `x` and `y` components, assuming the resulting vector is normalized. #... |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir2 | No Documentation 🚧 |
slerp
Performs a spherical linear interpolation between
selfandrhsbased on the values. This corresponds to interpolating between the two directions at a constant angular velocity. Whens == 0.0, the result will be equal toself. Whens == 1.0, the result will be equal torhs.Example
# use bevy_math::Dir2; # use approx::{assert_relative_eq, RelativeEq}; # let dir1 = Dir2::X; let dir2 = Dir2::Y; let result1 = dir1.slerp(dir2, 1.0 / 3.0); #[cfg(feature = "approx")] assert_relative_eq!(result1, Dir2::from_xy(0.75_f32.sqrt(), 0.5).unwrap()); let result2 = dir1.slerp(dir2, 0.5); #[cfg(feature = "approx")] assert_relative_eq!(result2, Dir2::from_xy(0.5_f32.sqrt(), 0.5_f32.sqrt()).unwrap());
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir2 | No Documentation 🚧 |
new_unchecked
Create a [
Dir2] from a [Vec2] that is already normalized.Warning
valuemust be normalized, i.e its length must be1.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| value | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir2 | No Documentation 🚧 |
rotation_from_y
Get the rotation that rotates the Y-axis to this direction.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir2 | No Documentation 🚧 |
rotation_to_x
Get the rotation that rotates this direction to the X-axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
rotation_to
Get the rotation that rotates this direction to
other.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
rotation_to_y
Get the rotation that rotates this direction to the Y-axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
fast_renormalize
Returns
selfafter an approximate normalization, assuming the value is already nearly normalized. Useful for preventing numerical error accumulation. See [Dir3::fast_renormalize] for an example of when such error accumulation might occur.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir2 | No Documentation 🚧 |
rotation_from
Get the rotation that rotates
otherto this direction.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
as_vec2
Returns the inner [
Vec2]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
rotation_from_x
Get the rotation that rotates the X-axis to this direction.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
from_xy_unchecked
Create a direction from its
xandycomponents, assuming the resulting vector is normalized.Warning
The vector produced from
xandymust be normalized, i.e its length must be1.0.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir2 | No Documentation 🚧 |
Dir3
Dir3
- glam::Vec3
Description
A normalized vector pointing in a direction in 3D space
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new_unchecked | Create a [`Dir3`] from a [`Vec3`] that is already normalized. # Warning `value` must be normalize... |
| from_xyz_unchecked | Create a direction from its `x`, `y`, and `z` components, assuming the resulting vector is normaliz... |
| fast_renormalize | Returns `self` after an approximate normalization, assuming the value is already nearly normalized.... |
| neg | No Documentation 🚧 |
| as_vec3 | Returns the inner [`Vec3`] |
| mul | No Documentation 🚧 |
| slerp | Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`. This c... |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
new_unchecked
Create a [
Dir3] from a [Vec3] that is already normalized.Warning
valuemust be normalized, i.e its length must be1.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| value | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
from_xyz_unchecked
Create a direction from its
x,y, andzcomponents, assuming the resulting vector is normalized.Warning
The vector produced from
x,y, andzmust be normalized, i.e its length must be1.0.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
fast_renormalize
Returns
selfafter an approximate normalization, assuming the value is already nearly normalized. Useful for preventing numerical error accumulation.Example
The following seemingly benign code would start accumulating errors over time, leading to
direventually not being normalized anymore.# use bevy_math::prelude::*; # let N: usize = 200; let mut dir = Dir3::X; let quaternion = Quat::from_euler(EulerRot::XYZ, 1.0, 2.0, 3.0); for i in 0..N { dir = quaternion * dir; }Instead, do the following.
# use bevy_math::prelude::*; # let N: usize = 200; let mut dir = Dir3::X; let quaternion = Quat::from_euler(EulerRot::XYZ, 1.0, 2.0, 3.0); for i in 0..N { dir = quaternion * dir; dir = dir.fast_renormalize(); }
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
as_vec3
Returns the inner [
Vec3]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
slerp
Performs a spherical linear interpolation between
selfandrhsbased on the values. This corresponds to interpolating between the two directions at a constant angular velocity. Whens == 0.0, the result will be equal toself. Whens == 1.0, the result will be equal torhs.Example
# use bevy_math::Dir3; # use approx::{assert_relative_eq, RelativeEq}; # let dir1 = Dir3::X; let dir2 = Dir3::Y; let result1 = dir1.slerp(dir2, 1.0 / 3.0); #[cfg(feature = "approx")] assert_relative_eq!( result1, Dir3::from_xyz(0.75_f32.sqrt(), 0.5, 0.0).unwrap(), epsilon = 0.000001 ); let result2 = dir1.slerp(dir2, 0.5); #[cfg(feature = "approx")] assert_relative_eq!(result2, Dir3::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap());
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
Dir3A
Dir3A
- glam::Vec3A
Description
A normalized SIMD vector pointing in a direction in 3D space.
This type stores a 16 byte aligned [
Vec3A]. This may or may not be faster than [Dir3]: make sure to benchmark!
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new_unchecked | Create a [`Dir3A`] from a [`Vec3A`] that is already normalized. # Warning `value` must be normali... |
| as_vec3a | Returns the inner [`Vec3A`] |
| clone | No Documentation 🚧 |
| fast_renormalize | Returns `self` after an approximate normalization, assuming the value is already nearly normalized.... |
| mul | No Documentation 🚧 |
| neg | No Documentation 🚧 |
| slerp | Performs a spherical linear interpolation between `self` and `rhs` based on the value `s`. This c... |
| from_xyz_unchecked | Create a direction from its `x`, `y`, and `z` components, assuming the resulting vector is normaliz... |
| eq | No Documentation 🚧 |
new_unchecked
Create a [
Dir3A] from a [Vec3A] that is already normalized.Warning
valuemust be normalized, i.e its length must be1.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| value | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3A | No Documentation 🚧 |
as_vec3a
Returns the inner [
Vec3A]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3A | No Documentation 🚧 |
fast_renormalize
Returns
selfafter an approximate normalization, assuming the value is already nearly normalized. Useful for preventing numerical error accumulation. See [Dir3::fast_renormalize] for an example of when such error accumulation might occur.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3A | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3A | No Documentation 🚧 |
slerp
Performs a spherical linear interpolation between
selfandrhsbased on the values. This corresponds to interpolating between the two directions at a constant angular velocity. Whens == 0.0, the result will be equal toself. Whens == 1.0, the result will be equal torhs.Example
# use bevy_math::Dir3A; # use approx::{assert_relative_eq, RelativeEq}; # let dir1 = Dir3A::X; let dir2 = Dir3A::Y; let result1 = dir1.slerp(dir2, 1.0 / 3.0); #[cfg(feature = "approx")] assert_relative_eq!( result1, Dir3A::from_xyz(0.75_f32.sqrt(), 0.5, 0.0).unwrap(), epsilon = 0.000001 ); let result2 = dir1.slerp(dir2, 0.5); #[cfg(feature = "approx")] assert_relative_eq!(result2, Dir3A::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap());
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Dir3A | No Documentation 🚧 |
| rhs | Dir3A | No Documentation 🚧 |
| s | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3A | No Documentation 🚧 |
from_xyz_unchecked
Create a direction from its
x,y, andzcomponents, assuming the resulting vector is normalized.Warning
The vector produced from
x,y, andzmust be normalized, i.e its length must be1.0.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3A | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
FloatOrd
FloatOrd
- f32
Description
A wrapper for floats that implements [
Ord], [Eq], and [Hash] traits.This is a work around for the fact that the IEEE 754-2008 standard, implemented by Rust's [
f32] type, doesn't define an ordering forNaN, andNaNis not considered equal to any otherNaN.Wrapping a float with
FloatOrdbreaks conformance with the standard by sortingNaNas less than all other numbers and equal to any otherNaN.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| neg | No Documentation 🚧 |
| lt | No Documentation 🚧 |
| gt | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| ge | No Documentation 🚧 |
| le | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | FloatOrd | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | FloatOrd | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | FloatOrd | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | FloatOrd | No Documentation 🚧 |
lt
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
gt
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
ge
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
le
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
Isometry2d
Isometry2d
- rotation:bevy_math::rotation2d::Rot2
- translation:glam::Vec2
Description
An isometry in two dimensions, representing a rotation followed by a translation. This can often be useful for expressing relative positions and transformations from one position to another.
In particular, this type represents a distance-preserving transformation known as a rigid motion or a direct motion, and belongs to the special Euclidean group SE(2). This includes translation and rotation, but excludes reflection.
For the three-dimensional version, see [
Isometry3d].Example
Isometries can be created from a given translation and rotation:
# use bevy_math::{Isometry2d, Rot2, Vec2}; # let iso = Isometry2d::new(Vec2::new(2.0, 1.0), Rot2::degrees(90.0));Or from separate parts:
# use bevy_math::{Isometry2d, Rot2, Vec2}; # let iso1 = Isometry2d::from_translation(Vec2::new(2.0, 1.0)); let iso2 = Isometry2d::from_rotation(Rot2::degrees(90.0));The isometries can be used to transform points:
# use approx::assert_abs_diff_eq; # use bevy_math::{Isometry2d, Rot2, Vec2}; # let iso = Isometry2d::new(Vec2::new(2.0, 1.0), Rot2::degrees(90.0)); let point = Vec2::new(4.0, 4.0); // These are equivalent let result = iso.transform_point(point); let result = iso * point; assert_eq!(result, Vec2::new(-2.0, 5.0));Isometries can also be composed together:
# use bevy_math::{Isometry2d, Rot2, Vec2}; # # let iso = Isometry2d::new(Vec2::new(2.0, 1.0), Rot2::degrees(90.0)); # let iso1 = Isometry2d::from_translation(Vec2::new(2.0, 1.0)); # let iso2 = Isometry2d::from_rotation(Rot2::degrees(90.0)); # assert_eq!(iso1 * iso2, iso);One common operation is to compute an isometry representing the relative positions of two objects for things like intersection tests. This can be done with an inverse transformation:
# use bevy_math::{Isometry2d, Rot2, Vec2}; # let circle_iso = Isometry2d::from_translation(Vec2::new(2.0, 1.0)); let rectangle_iso = Isometry2d::from_rotation(Rot2::degrees(90.0)); // Compute the relative position and orientation between the two shapes let relative_iso = circle_iso.inverse() * rectangle_iso; // Or alternatively, to skip an extra rotation operation: let relative_iso = circle_iso.inverse_mul(rectangle_iso);
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| mul | No Documentation 🚧 |
| mul-2 | No Documentation 🚧 |
| from_xy | Create a two-dimensional isometry from a translation with the given `x` and `y` components. |
| from_translation | Create a two-dimensional isometry from a translation. |
| clone | No Documentation 🚧 |
| new | Create a two-dimensional isometry from a rotation and a translation. |
| eq | No Documentation 🚧 |
| inverse_transform_point | Transform a point by rotating and translating it using the inverse of this isometry. This is more ... |
| from_rotation | Create a two-dimensional isometry from a rotation. |
| inverse_mul | Compute `iso1.inverse() * iso2` in a more efficient way for one-shot cases. If the same isometry is used multiple times, it is more efficient to instead compute the inverse once and use that for each transformation. |
| mul-1 | No Documentation 🚧 |
| inverse | The inverse isometry that undoes this one. |
| transform_point | Transform a point by rotating and translating it using this isometry. |
mul
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Isometry2d | No Documentation 🚧 |
| rhs | Isometry2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry2d | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry2d | No Documentation 🚧 |
| arg1 | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
from_xy
Create a two-dimensional isometry from a translation with the given
xandycomponents.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry2d | No Documentation 🚧 |
from_translation
Create a two-dimensional isometry from a translation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| translation | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry2d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Isometry2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry2d | No Documentation 🚧 |
new
Create a two-dimensional isometry from a rotation and a translation.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry2d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Isometry2d | No Documentation 🚧 |
| other | Isometry2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
inverse_transform_point
Transform a point by rotating and translating it using the inverse of this isometry. This is more efficient than
iso.inverse().transform_point(point)for one-shot cases. If the same isometry is used multiple times, it is more efficient to instead compute the inverse once and use that for each transformation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Isometry2d | No Documentation 🚧 |
| point | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
from_rotation
Create a two-dimensional isometry from a rotation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| rotation | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry2d | No Documentation 🚧 |
inverse_mul
Compute
iso1.inverse() * iso2in a more efficient way for one-shot cases. If the same isometry is used multiple times, it is more efficient to instead compute the inverse once and use that for each transformation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Isometry2d | No Documentation 🚧 |
| rhs | Isometry2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry2d | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry2d | No Documentation 🚧 |
| arg1 | Dir2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir2 | No Documentation 🚧 |
inverse
The inverse isometry that undoes this one.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Isometry2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry2d | No Documentation 🚧 |
transform_point
Transform a point by rotating and translating it using this isometry.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Isometry2d | No Documentation 🚧 |
| point | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
Isometry3d
Isometry3d
- rotation:glam::Quat
- translation:glam::Vec3A
Description
An isometry in three dimensions, representing a rotation followed by a translation. This can often be useful for expressing relative positions and transformations from one position to another.
In particular, this type represents a distance-preserving transformation known as a rigid motion or a direct motion, and belongs to the special Euclidean group SE(3). This includes translation and rotation, but excludes reflection.
For the two-dimensional version, see [
Isometry2d].Example
Isometries can be created from a given translation and rotation:
# use bevy_math::{Isometry3d, Quat, Vec3}; # use std::f32::consts::FRAC_PI_2; # let iso = Isometry3d::new(Vec3::new(2.0, 1.0, 3.0), Quat::from_rotation_z(FRAC_PI_2));Or from separate parts:
# use bevy_math::{Isometry3d, Quat, Vec3}; # use std::f32::consts::FRAC_PI_2; # let iso1 = Isometry3d::from_translation(Vec3::new(2.0, 1.0, 3.0)); let iso2 = Isometry3d::from_rotation(Quat::from_rotation_z(FRAC_PI_2));The isometries can be used to transform points:
# use approx::assert_relative_eq; # use bevy_math::{Isometry3d, Quat, Vec3}; # use std::f32::consts::FRAC_PI_2; # let iso = Isometry3d::new(Vec3::new(2.0, 1.0, 3.0), Quat::from_rotation_z(FRAC_PI_2)); let point = Vec3::new(4.0, 4.0, 4.0); // These are equivalent let result = iso.transform_point(point); let result = iso * point; assert_relative_eq!(result, Vec3::new(-2.0, 5.0, 7.0));Isometries can also be composed together:
# use bevy_math::{Isometry3d, Quat, Vec3}; # use std::f32::consts::FRAC_PI_2; # # let iso = Isometry3d::new(Vec3::new(2.0, 1.0, 3.0), Quat::from_rotation_z(FRAC_PI_2)); # let iso1 = Isometry3d::from_translation(Vec3::new(2.0, 1.0, 3.0)); # let iso2 = Isometry3d::from_rotation(Quat::from_rotation_z(FRAC_PI_2)); # assert_eq!(iso1 * iso2, iso);One common operation is to compute an isometry representing the relative positions of two objects for things like intersection tests. This can be done with an inverse transformation:
# use bevy_math::{Isometry3d, Quat, Vec3}; # use std::f32::consts::FRAC_PI_2; # let sphere_iso = Isometry3d::from_translation(Vec3::new(2.0, 1.0, 3.0)); let cuboid_iso = Isometry3d::from_rotation(Quat::from_rotation_z(FRAC_PI_2)); // Compute the relative position and orientation between the two shapes let relative_iso = sphere_iso.inverse() * cuboid_iso; // Or alternatively, to skip an extra rotation operation: let relative_iso = sphere_iso.inverse_mul(cuboid_iso);
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| inverse_mul | Compute `iso1.inverse() * iso2` in a more efficient way for one-shot cases. If the same isometry is used multiple times, it is more efficient to instead compute the inverse once and use that for each transformation. |
| mul | No Documentation 🚧 |
| inverse | The inverse isometry that undoes this one. |
| mul-3 | No Documentation 🚧 |
| mul-1 | No Documentation 🚧 |
| from_xyz | Create a three-dimensional isometry from a translation with the given `x`, `y`, and `z` components. |
| clone | No Documentation 🚧 |
| mul-2 | No Documentation 🚧 |
| from_rotation | Create a three-dimensional isometry from a rotation. |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Isometry3d | No Documentation 🚧 |
| other | Isometry3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
inverse_mul
Compute
iso1.inverse() * iso2in a more efficient way for one-shot cases. If the same isometry is used multiple times, it is more efficient to instead compute the inverse once and use that for each transformation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Isometry3d | No Documentation 🚧 |
| rhs | Isometry3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Isometry3d | No Documentation 🚧 |
| rhs | Isometry3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
inverse
The inverse isometry that undoes this one.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Isometry3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
| arg1 | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
| arg1 | Dir3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
from_xyz
Create a three-dimensional isometry from a translation with the given
x,y, andzcomponents.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Isometry3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
| arg1 | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
from_rotation
Create a three-dimensional isometry from a rotation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| rotation | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
Annulus
Annulus
- inner_circle:bevy_math::primitives::dim2::Circle
- outer_circle:bevy_math::primitives::dim2::Circle
Description
A primitive shape formed by the region between two circles, also known as a ring.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| thickness | Get the thickness of the annulus |
| eq | No Documentation 🚧 |
| new | Create a new [`Annulus`] from the radii of the inner and outer circle |
| diameter | Get the diameter of the annulus |
| closest_point | Finds the point on the annulus that is closest to the given `point`: - If the point is outside of ... |
| clone | No Documentation 🚧 |
thickness
Get the thickness of the annulus
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Annulus | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Create a new [
Annulus] from the radii of the inner and outer circle
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Annulus | No Documentation 🚧 |
diameter
Get the diameter of the annulus
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Annulus | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
closest_point
Finds the point on the annulus that is closest to the given
point:
- If the point is outside of the annulus completely, the returned point will be on the outer perimeter.
- If the point is inside of the inner circle (hole) of the annulus, the returned point will be on the inner perimeter.
- Otherwise, the returned point is overlapping the annulus and returned as is.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Annulus | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Annulus | No Documentation 🚧 |
Arc2d
Arc2d
- radius:f32
- half_angle:f32
Description
A primitive representing an arc between two points on a circle.
An arc has no area. If you want to include the portion of a circle's area swept out by the arc, use the pie-shaped [
CircularSector]. If you want to include only the space inside the convex hull of the arc, use the bowl-shaped [CircularSegment].The arc is drawn starting from [
Vec2::Y], extending byhalf_angleradians on either side. The center of the circle is the origin [Vec2::ZERO]. Note that this means that the origin may not be within theArc2d's convex hull.Warning: Arcs with negative angle or radius, or with angle greater than an entire circle, are not officially supported. It is recommended to normalize arcs to have an angle in [0, 2π].
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| sagitta | Get the length of the sagitta of this arc, that is, the length of the line between the midpoints o... |
| from_degrees | Create a new [`Arc2d`] from a `radius` and an `angle` in degrees. |
| length | Get the length of the arc |
| is_minor | Produces true if the arc is at most half a circle. **Note:** This is not the negation of [`is_major`](Self::is_major): an exact semicircle is both major and minor. |
| eq | No Documentation 🚧 |
| from_radians | Create a new [`Arc2d`] from a `radius` and an `angle` in radians |
| clone | No Documentation 🚧 |
| chord_midpoint | Get the midpoint of the two endpoints (the midpoint of the chord) |
| right_endpoint | Get the right-hand end point of the arc |
| angle | Get the angle of the arc |
| from_turns | Create a new [`Arc2d`] from a `radius` and a `fraction` of a single turn. For instance, `0.5` turns is a semicircle. |
| new | Create a new [`Arc2d`] from a `radius` and a `half_angle` |
| chord_length | Get the distance between the endpoints (the length of the chord) |
| left_endpoint | Get the left-hand end point of the arc |
| apothem | Get the length of the apothem of this arc, that is, the distance from the center of the circle to ... |
| midpoint | Get the midpoint of the arc |
| is_major | Produces true if the arc is at least half a circle. **Note:** This is not the negation of [`is_minor`](Self::is_minor): an exact semicircle is both major and minor. |
| half_chord_length | Get half the distance between the endpoints (half the length of the chord) |
sagitta
Get the length of the sagitta of this arc, that is, the length of the line between the midpoints of the arc and its chord. Equivalently, the height of the triangle whose base is the chord and whose apex is the midpoint of the arc. The sagitta is also the sum of the
radiusand theapothem.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_degrees
Create a new [
Arc2d] from aradiusand ananglein degrees.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Arc2d | No Documentation 🚧 |
length
Get the length of the arc
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
is_minor
Produces true if the arc is at most half a circle. Note: This is not the negation of
is_major: an exact semicircle is both major and minor.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_radians
Create a new [
Arc2d] from aradiusand ananglein radians
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Arc2d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Arc2d | No Documentation 🚧 |
chord_midpoint
Get the midpoint of the two endpoints (the midpoint of the chord)
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
right_endpoint
Get the right-hand end point of the arc
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
angle
Get the angle of the arc
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_turns
Create a new [
Arc2d] from aradiusand afractionof a single turn. For instance,0.5turns is a semicircle.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Arc2d | No Documentation 🚧 |
new
Create a new [
Arc2d] from aradiusand ahalf_angle
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Arc2d | No Documentation 🚧 |
chord_length
Get the distance between the endpoints (the length of the chord)
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
left_endpoint
Get the left-hand end point of the arc
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
apothem
Get the length of the apothem of this arc, that is, the distance from the center of the circle to the midpoint of the chord, in the direction of the midpoint of the arc. Equivalently, the
radiusminus thesagitta. Note that for amajorarc, the apothem will be negative.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
midpoint
Get the midpoint of the arc
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
is_major
Produces true if the arc is at least half a circle. Note: This is not the negation of
is_minor: an exact semicircle is both major and minor.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
half_chord_length
Get half the distance between the endpoints (half the length of the chord)
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Arc2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
Capsule2d
Capsule2d
- radius:f32
- half_length:f32
Description
A 2D capsule primitive, also known as a stadium or pill shape.
A two-dimensional capsule is defined as a neighborhood of points at a distance (radius) from a line
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Create a new `Capsule2d` from a radius and length |
| clone | No Documentation 🚧 |
| to_inner_rectangle | Get the part connecting the semicircular ends of the capsule as a [`Rectangle`] |
| eq | No Documentation 🚧 |
new
Create a new
Capsule2dfrom a radius and length
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Capsule2d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Capsule2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Capsule2d | No Documentation 🚧 |
to_inner_rectangle
Get the part connecting the semicircular ends of the capsule as a [
Rectangle]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Capsule2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rectangle | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
Circle
Circle
- radius:f32
Description
A circle primitive, representing the set of points some distance from the origin
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| diameter | Get the diameter of the circle |
| closest_point | Finds the point on the circle that is closest to the given `point`. If the point is outside the ci... |
| new | Create a new [`Circle`] from a `radius` |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
diameter
Get the diameter of the circle
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Circle | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
closest_point
Finds the point on the circle that is closest to the given
point. If the point is outside the circle, the returned point will be on the perimeter of the circle. Otherwise, it will be inside the circle and returned as is.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
new
Create a new [
Circle] from aradius
Arguments
| Name | Type | Documentation |
|---|---|---|
| radius | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Circle | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Circle | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Circle | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
CircularSector
CircularSector
- arc:bevy_math::primitives::dim2::Arc2d
Description
A primitive representing a circular sector: a pie slice of a circle.
The segment is positioned so that it always includes [
Vec2::Y] and is vertically symmetrical. To orient the sector differently, apply a rotation. The sector is drawn with the center of its circle at the origin [Vec2::ZERO].Warning: Circular sectors with negative angle or radius, or with angle greater than an entire circle, are not officially supported. We recommend normalizing circular sectors to have an angle in [0, 2π].
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| chord_midpoint | Get the midpoint of the chord defined by the sector See [`Arc2d::chord_midpoint`] |
| from_degrees | Create a new [`CircularSector`] from a `radius` and an `angle` in degrees. |
| sagitta | Get the length of the sagitta of this sector See [`Arc2d::sagitta`] |
| angle | Get the angle of the sector |
| half_angle | Get half the angle of the sector |
| eq | No Documentation 🚧 |
| from_turns | Create a new [`CircularSector`] from a `radius` and a number of `turns` of a circle. For instance, `0.5` turns is a semicircle. |
| clone | No Documentation 🚧 |
| half_chord_length | Get half the length of the chord defined by the sector See [`Arc2d::half_chord_length`] |
| from_radians | Create a new [`CircularSector`] from a `radius` and an `angle` in radians. |
| apothem | Get the length of the apothem of this sector See [`Arc2d::apothem`] |
| radius | Get the radius of the sector |
| chord_length | Get the length of the chord defined by the sector See [`Arc2d::chord_length`] |
| arc_length | Get the length of the arc defining the sector |
| new | Create a new [`CircularSector`] from a `radius` and an `angle` |
chord_midpoint
Get the midpoint of the chord defined by the sector See [
Arc2d::chord_midpoint]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSector | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
from_degrees
Create a new [
CircularSector] from aradiusand ananglein degrees.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CircularSector | No Documentation 🚧 |
sagitta
Get the length of the sagitta of this sector See [
Arc2d::sagitta]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSector | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
angle
Get the angle of the sector
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSector | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
half_angle
Get half the angle of the sector
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSector | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSector | No Documentation 🚧 |
| other | CircularSector | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_turns
Create a new [
CircularSector] from aradiusand a number ofturnsof a circle. For instance,0.5turns is a semicircle.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CircularSector | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSector | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CircularSector | No Documentation 🚧 |
half_chord_length
Get half the length of the chord defined by the sector See [
Arc2d::half_chord_length]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSector | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_radians
Create a new [
CircularSector] from aradiusand ananglein radians.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CircularSector | No Documentation 🚧 |
apothem
Get the length of the apothem of this sector See [
Arc2d::apothem]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSector | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
radius
Get the radius of the sector
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSector | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
chord_length
Get the length of the chord defined by the sector See [
Arc2d::chord_length]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSector | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
arc_length
Get the length of the arc defining the sector
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSector | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
new
Create a new [
CircularSector] from aradiusand anangle
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CircularSector | No Documentation 🚧 |
CircularSegment
CircularSegment
- arc:bevy_math::primitives::dim2::Arc2d
Description
A primitive representing a circular segment: the area enclosed by the arc of a circle and its chord (the line between its endpoints).
The segment is drawn starting from [
Vec2::Y], extending equally on either side. To orient the segment differently, apply a rotation. The segment is drawn with the center of its circle at the origin [Vec2::ZERO]. When positioning a segment, theapothemfunction may be particularly useful.Warning: Circular segments with negative angle or radius, or with angle greater than an entire circle, are not officially supported. We recommend normalizing circular segments to have an angle in [0, 2π].
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Create a new [`CircularSegment`] from a `radius`, and an `angle` |
| half_angle | Get the half-angle of the segment |
| clone | No Documentation 🚧 |
| sagitta | Get the length of the sagitta of this segment, also known as its height See [`Arc2d::sagitta`] |
| chord_midpoint | Get the midpoint of the segment's base, also known as its chord |
| eq | No Documentation 🚧 |
| apothem | Get the length of the apothem of this segment, which is the signed distance between the segment an... |
| from_degrees | Create a new [`CircularSegment`] from a `radius` and an `angle` in degrees. |
| from_radians | Create a new [`CircularSegment`] from a `radius` and an `angle` in radians. |
| half_chord_length | Get half the length of the segment's base, also known as its chord |
| chord_length | Get the length of the segment's base, also known as its chord |
| radius | Get the radius of the segment |
| arc_length | Get the length of the arc defining the segment |
| from_turns | Create a new [`CircularSegment`] from a `radius` and a number of `turns` of a circle. For instance, `0.5` turns is a semicircle. |
| angle | Get the angle of the segment |
new
Create a new [
CircularSegment] from aradius, and anangle
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CircularSegment | No Documentation 🚧 |
half_angle
Get the half-angle of the segment
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSegment | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSegment | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CircularSegment | No Documentation 🚧 |
sagitta
Get the length of the sagitta of this segment, also known as its height See [
Arc2d::sagitta]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSegment | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
chord_midpoint
Get the midpoint of the segment's base, also known as its chord
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSegment | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSegment | No Documentation 🚧 |
| other | CircularSegment | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
apothem
Get the length of the apothem of this segment, which is the signed distance between the segment and the center of its circle See [
Arc2d::apothem]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSegment | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_degrees
Create a new [
CircularSegment] from aradiusand ananglein degrees.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CircularSegment | No Documentation 🚧 |
from_radians
Create a new [
CircularSegment] from aradiusand ananglein radians.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CircularSegment | No Documentation 🚧 |
half_chord_length
Get half the length of the segment's base, also known as its chord
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSegment | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
chord_length
Get the length of the segment's base, also known as its chord
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSegment | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
radius
Get the radius of the segment
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSegment | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
arc_length
Get the length of the arc defining the segment
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSegment | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_turns
Create a new [
CircularSegment] from aradiusand a number ofturnsof a circle. For instance,0.5turns is a semicircle.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | CircularSegment | No Documentation 🚧 |
angle
Get the angle of the segment
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | CircularSegment | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
Ellipse
Ellipse
- half_size:glam::Vec2
Description
An ellipse primitive, which is like a circle, but the width and height can be different
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Create a new `Ellipse` from half of its width and height. This corresponds to the two perpendicula... |
| focal_length | Get the focal length of the ellipse. This corresponds to the distance between one of the foci and t... |
| from_size | Create a new `Ellipse` from a given full size. `size.x` is the diameter along the X axis, and `size.y`... |
| eq | No Documentation 🚧 |
| semi_major | Returns the length of the semi-major axis. This corresponds to the longest radius of the ellipse. |
| clone | No Documentation 🚧 |
| eccentricity | Returns the [eccentricity](https://en.wikipedia.org/wiki/Eccentricity_(mathematics)) of the ellipse. It can be thought of as a measure of how "stretched" or elongated the ellipse is. The value should be in the range [0, 1), where 0 represents a circle, and 1 represents a parabola. |
| semi_minor | Returns the length of the semi-minor axis. This corresponds to the shortest radius of the ellipse. |
new
Create a new
Ellipsefrom half of its width and height. This corresponds to the two perpendicular radii defining the ellipse.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Ellipse | No Documentation 🚧 |
focal_length
Get the focal length of the ellipse. This corresponds to the distance between one of the foci and the center of the ellipse. The focal length of an ellipse is related to its eccentricity by
eccentricity = focal_length / semi_major
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Ellipse | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_size
Create a new
Ellipsefrom a given full size.size.xis the diameter along the X axis, andsize.yis the diameter along the Y axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| size | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Ellipse | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
semi_major
Returns the length of the semi-major axis. This corresponds to the longest radius of the ellipse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Ellipse | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Ellipse | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Ellipse | No Documentation 🚧 |
eccentricity
Returns the eccentricity of the ellipse. It can be thought of as a measure of how "stretched" or elongated the ellipse is. The value should be in the range [0, 1), where 0 represents a circle, and 1 represents a parabola.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Ellipse | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
semi_minor
Returns the length of the semi-minor axis. This corresponds to the shortest radius of the ellipse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Ellipse | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
Line2d
Line2d
- direction:bevy_math::direction::Dir2
Description
An infinite line going through the origin along a direction in 2D space.
For a finite line: [
Segment2d]
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Line2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Line2d | No Documentation 🚧 |
Plane2d
Plane2d
- normal:bevy_math::direction::Dir2
Description
An unbounded plane in 2D space. It forms a separating surface through the origin, stretching infinitely far
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Create a new `Plane2d` from a normal # Panics Panics if the given `normal` is zero (or very close... |
| eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
new
Create a new
Plane2dfrom a normalPanics
Panics if the given
normalis zero (or very close to zero), or non-finite.
Arguments
| Name | Type | Documentation |
|---|---|---|
| normal | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Plane2d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Plane2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Plane2d | No Documentation 🚧 |
Rectangle
Rectangle
- half_size:glam::Vec2
Description
A rectangle primitive, which is like a square, except that the width and height can be different
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| closest_point | Finds the point on the rectangle that is closest to the given `point`. If the point is outside the... |
| from_size | Create a new `Rectangle` from a given full size |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| new | Create a new `Rectangle` from a full width and height |
| from_corners | Create a new `Rectangle` from two corner points |
| from_length | Create a `Rectangle` from a single length. The resulting `Rectangle` will be the same size in ever... |
| size | Get the size of the rectangle |
closest_point
Finds the point on the rectangle that is closest to the given
point. If the point is outside the rectangle, the returned point will be on the perimeter of the rectangle. Otherwise, it will be inside the rectangle and returned as is.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
from_size
Create a new
Rectanglefrom a given full size
Arguments
| Name | Type | Documentation |
|---|---|---|
| size | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rectangle | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rectangle | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rectangle | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Create a new
Rectanglefrom a full width and height
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rectangle | No Documentation 🚧 |
from_corners
Create a new
Rectanglefrom two corner points
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rectangle | No Documentation 🚧 |
from_length
Create a
Rectanglefrom a single length. The resultingRectanglewill be the same size in every direction.
Arguments
| Name | Type | Documentation |
|---|---|---|
| length | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rectangle | No Documentation 🚧 |
size
Get the size of the rectangle
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rectangle | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
RegularPolygon
RegularPolygon
- circumcircle:bevy_math::primitives::dim2::Circle
- sides:u32
Description
A polygon centered on the origin where all vertices lie on a circle, equally far apart.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| internal_angle_degrees | Get the internal angle of the regular polygon in degrees. This is the angle formed by two adjacent... |
| internal_angle_radians | Get the internal angle of the regular polygon in radians. This is the angle formed by two adjacent... |
| new | Create a new `RegularPolygon` from the radius of the circumcircle and a number of sides # Panics ... |
| inradius | Get the inradius or apothem of the regular polygon. This is the radius of the largest circle that ... |
| eq | No Documentation 🚧 |
| external_angle_radians | Get the external angle of the regular polygon in radians. This is the angle formed by two adjacent... |
| clone | No Documentation 🚧 |
| external_angle_degrees | Get the external angle of the regular polygon in degrees. This is the angle formed by two adjacent... |
| side_length | Get the length of one side of the regular polygon |
| circumradius | Get the radius of the circumcircle on which all vertices of the regular polygon lie |
internal_angle_degrees
Get the internal angle of the regular polygon in degrees. This is the angle formed by two adjacent sides with points within the angle being in the interior of the polygon
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RegularPolygon | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
internal_angle_radians
Get the internal angle of the regular polygon in radians. This is the angle formed by two adjacent sides with points within the angle being in the interior of the polygon
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RegularPolygon | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
new
Create a new
RegularPolygonfrom the radius of the circumcircle and a number of sidesPanics
Panics if
circumradiusis negative
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RegularPolygon | No Documentation 🚧 |
inradius
Get the inradius or apothem of the regular polygon. This is the radius of the largest circle that can be drawn within the polygon
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RegularPolygon | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RegularPolygon | No Documentation 🚧 |
| other | RegularPolygon | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
external_angle_radians
Get the external angle of the regular polygon in radians. This is the angle formed by two adjacent sides with points within the angle being in the exterior of the polygon
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RegularPolygon | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RegularPolygon | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RegularPolygon | No Documentation 🚧 |
external_angle_degrees
Get the external angle of the regular polygon in degrees. This is the angle formed by two adjacent sides with points within the angle being in the exterior of the polygon
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RegularPolygon | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
side_length
Get the length of one side of the regular polygon
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RegularPolygon | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
circumradius
Get the radius of the circumcircle on which all vertices of the regular polygon lie
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RegularPolygon | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
Rhombus
Rhombus
- half_diagonals:glam::Vec2
Description
A rhombus primitive, also known as a diamond shape. A four sided polygon, centered on the origin, where opposite sides are parallel but without requiring right angles.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| from_inradius | Create a new `Rhombus` from a given inradius with all inner angles equal. |
| circumradius | Get the radius of the circumcircle on which all vertices of the rhombus lie |
| eq | No Documentation 🚧 |
| inradius | Get the radius of the largest circle that can be drawn within the rhombus |
| from_side | Create a new `Rhombus` from a side length with all inner angles equal. |
| closest_point | Finds the point on the rhombus that is closest to the given `point`. If the point is outside the r... |
| new | Create a new `Rhombus` from a vertical and horizontal diagonal sizes. |
| clone | No Documentation 🚧 |
| side | Get the length of each side of the rhombus |
from_inradius
Create a new
Rhombusfrom a given inradius with all inner angles equal.
Arguments
| Name | Type | Documentation |
|---|---|---|
| inradius | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rhombus | No Documentation 🚧 |
circumradius
Get the radius of the circumcircle on which all vertices of the rhombus lie
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rhombus | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
inradius
Get the radius of the largest circle that can be drawn within the rhombus
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rhombus | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_side
Create a new
Rhombusfrom a side length with all inner angles equal.
Arguments
| Name | Type | Documentation |
|---|---|---|
| side | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rhombus | No Documentation 🚧 |
closest_point
Finds the point on the rhombus that is closest to the given
point. If the point is outside the rhombus, the returned point will be on the perimeter of the rhombus. Otherwise, it will be inside the rhombus and returned as is.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
new
Create a new
Rhombusfrom a vertical and horizontal diagonal sizes.
Arguments
| Name | Type | Documentation |
|---|---|---|
| horizontal_diagonal | f32 | No Documentation 🚧 |
| vertical_diagonal | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rhombus | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rhombus | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rhombus | No Documentation 🚧 |
side
Get the length of each side of the rhombus
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rhombus | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
Segment2d
Segment2d
- vertices:[glam::Vec2; 2]
Description
A line segment defined by two endpoints in 2D space.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| rotated_around | Compute the segment rotated around the given point by the given rotation. |
| reverse | Reverses the direction of the line segment by swapping the endpoints. |
| centered | Compute the segment with its center at the origin, keeping the same direction and length. |
| scaled_direction | Compute the vector from the first endpoint to the second endpoint. |
| scaled_left_normal | Compute the non-normalized counterclockwise normal on the left-hand side of the line segment. The ... |
| length_squared | Compute the squared length of the line segment. |
| left_normal | Compute the normalized counterclockwise normal on the left-hand side of the line segment. For the ... |
| scaled_right_normal | Compute the non-normalized clockwise normal on the right-hand side of the line segment. The length... |
| rotated_around_center | Compute the segment rotated around its own center. |
| point2 | Get the position of the second endpoint of the line segment. |
| reversed | Returns the line segment with its direction reversed by swapping the endpoints. |
| from_scaled_direction | Create a new `Segment2d` centered at the origin from a vector representing the direction and lengt... |
| new | Create a new `Segment2d` from its endpoints. |
| resized | Compute the segment with a new length, keeping the same direction and center. |
| from_direction_and_length | Create a new `Segment2d` centered at the origin with the given direction and length. The endpoints... |
| length | Compute the length of the line segment. |
| rotated | Compute the segment rotated around the origin by the given rotation. |
| center | Compute the midpoint between the two endpoints of the line segment. |
| right_normal | Compute the normalized clockwise normal on the right-hand side of the line segment. For the non-pa... |
| point1 | Get the position of the first endpoint of the line segment. |
| direction | Compute the normalized direction pointing from the first endpoint to the second endpoint. For the ... |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| from_ray_and_length | Create a new `Segment2d` starting from the origin of the given `ray`, going in the direction of th... |
| translated | Compute the segment translated by the given vector. |
rotated_around
Compute the segment rotated around the given point by the given rotation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
| rotation | Rot2 | No Documentation 🚧 |
| point | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment2d | No Documentation 🚧 |
reverse
Reverses the direction of the line segment by swapping the endpoints.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
centered
Compute the segment with its center at the origin, keeping the same direction and length.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment2d | No Documentation 🚧 |
scaled_direction
Compute the vector from the first endpoint to the second endpoint.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
scaled_left_normal
Compute the non-normalized counterclockwise normal on the left-hand side of the line segment. The length of the normal is the distance between the endpoints.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
length_squared
Compute the squared length of the line segment.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
left_normal
Compute the normalized counterclockwise normal on the left-hand side of the line segment. For the non-panicking version, see [
Segment2d::try_left_normal].Panics
Panics if a valid normal could not be computed, for example when the endpoints are coincident, NaN, or infinite.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir2 | No Documentation 🚧 |
scaled_right_normal
Compute the non-normalized clockwise normal on the right-hand side of the line segment. The length of the normal is the distance between the endpoints.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
rotated_around_center
Compute the segment rotated around its own center.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment2d | No Documentation 🚧 |
point2
Get the position of the second endpoint of the line segment.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
reversed
Returns the line segment with its direction reversed by swapping the endpoints.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment2d | No Documentation 🚧 |
from_scaled_direction
Create a new
Segment2dcentered at the origin from a vector representing the direction and length of the line segment. The endpoints will be at-scaled_direction / 2.0andscaled_direction / 2.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scaled_direction | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment2d | No Documentation 🚧 |
new
Create a new
Segment2dfrom its endpoints.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment2d | No Documentation 🚧 |
resized
Compute the segment with a new length, keeping the same direction and center.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment2d | No Documentation 🚧 |
from_direction_and_length
Create a new
Segment2dcentered at the origin with the given direction and length. The endpoints will be at-direction * length / 2.0anddirection * length / 2.0.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment2d | No Documentation 🚧 |
length
Compute the length of the line segment.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
rotated
Compute the segment rotated around the origin by the given rotation.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment2d | No Documentation 🚧 |
center
Compute the midpoint between the two endpoints of the line segment.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
right_normal
Compute the normalized clockwise normal on the right-hand side of the line segment. For the non-panicking version, see [
Segment2d::try_right_normal].Panics
Panics if a valid normal could not be computed, for example when the endpoints are coincident, NaN, or infinite.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir2 | No Documentation 🚧 |
point1
Get the position of the first endpoint of the line segment.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
direction
Compute the normalized direction pointing from the first endpoint to the second endpoint. For the non-panicking version, see [
Segment2d::try_direction].Panics
Panics if a valid direction could not be computed, for example when the endpoints are coincident, NaN, or infinite.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment2d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_ray_and_length
Create a new
Segment2dstarting from the origin of the givenray, going in the direction of the ray for the givenlength. The endpoints will be atray.originandray.origin + length * ray.direction.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment2d | No Documentation 🚧 |
translated
Compute the segment translated by the given vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment2d | No Documentation 🚧 |
Triangle2d
Triangle2d
- vertices:[glam::Vec2; 3]
Description
A triangle in 2D space
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| reversed | This triangle but reversed. |
| eq | No Documentation 🚧 |
| is_acute | Checks if the triangle is acute, meaning all angles are less than 90 degrees |
| is_degenerate | Checks if the triangle is degenerate, meaning it has zero area. A triangle is degenerate if the cr... |
| clone | No Documentation 🚧 |
| is_obtuse | Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees |
| reverse | Reverse the [`WindingOrder`] of the triangle by swapping the first and last vertices. |
| new | Create a new `Triangle2d` from points `a`, `b`, and `c` |
reversed
This triangle but reversed.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Triangle2d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle2d | No Documentation 🚧 |
| other | Triangle2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_acute
Checks if the triangle is acute, meaning all angles are less than 90 degrees
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_degenerate
Checks if the triangle is degenerate, meaning it has zero area. A triangle is degenerate if the cross product of the vectors
abandachas a length less than10e-7. This indicates that the three vertices are collinear or nearly collinear.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Triangle2d | No Documentation 🚧 |
is_obtuse
Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
reverse
Reverse the [
WindingOrder] of the triangle by swapping the first and last vertices.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
new
Create a new
Triangle2dfrom pointsa,b, andc
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Triangle2d | No Documentation 🚧 |
Capsule3d
Capsule3d
- radius:f32
- half_length:f32
Description
A 3D capsule primitive centered on the origin A three-dimensional capsule is defined as a surface at a distance (radius) from a line
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| to_cylinder | Get the part connecting the hemispherical ends of the capsule as a [`Cylinder`] |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| new | Create a new `Capsule3d` from a radius and length |
to_cylinder
Get the part connecting the hemispherical ends of the capsule as a [
Cylinder]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Capsule3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Cylinder | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Capsule3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Capsule3d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Create a new
Capsule3dfrom a radius and length
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Capsule3d | No Documentation 🚧 |
Cone
Cone
- radius:f32
- height:f32
Description
A cone primitive centered on the midpoint between the tip of the cone and the center of its base.
The cone is oriented with its tip pointing towards the Y axis.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| base_area | Get the surface area of the base of the cone |
| new | Create a new [`Cone`] from a radius and height. |
| slant_height | Get the slant height of the cone, the length of the line segment connecting a point on the base to... |
| eq | No Documentation 🚧 |
| base | Get the base of the cone as a [`Circle`] |
| lateral_area | Get the surface area of the side of the cone, also known as the lateral area |
| clone | No Documentation 🚧 |
base_area
Get the surface area of the base of the cone
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Cone | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
new
Create a new [
Cone] from a radius and height.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Cone | No Documentation 🚧 |
slant_height
Get the slant height of the cone, the length of the line segment connecting a point on the base to the apex
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Cone | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
base
Get the base of the cone as a [
Circle]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Cone | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Circle | No Documentation 🚧 |
lateral_area
Get the surface area of the side of the cone, also known as the lateral area
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Cone | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Cone | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Cone | No Documentation 🚧 |
ConicalFrustum
ConicalFrustum
- radius_top:f32
- radius_bottom:f32
- height:f32
Description
A conical frustum primitive. A conical frustum can be created by slicing off a section of a cone.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ConicalFrustum | No Documentation 🚧 |
| other | ConicalFrustum | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | ConicalFrustum | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | ConicalFrustum | No Documentation 🚧 |
Cuboid
Cuboid
- half_size:glam::Vec3
Description
A cuboid primitive, which is like a cube, except that the x, y, and z dimensions are not required to be the same.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| from_length | Create a `Cuboid` from a single length. The resulting `Cuboid` will be the same size in every dire... |
| closest_point | Finds the point on the cuboid that is closest to the given `point`. If the point is outside the cu... |
| new | Create a new `Cuboid` from a full x, y, and z length |
| size | Get the size of the cuboid |
| eq | No Documentation 🚧 |
| from_corners | Create a new `Cuboid` from two corner points |
| clone | No Documentation 🚧 |
| from_size | Create a new `Cuboid` from a given full size |
from_length
Create a
Cuboidfrom a single length. The resultingCuboidwill be the same size in every direction.
Arguments
| Name | Type | Documentation |
|---|---|---|
| length | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Cuboid | No Documentation 🚧 |
closest_point
Finds the point on the cuboid that is closest to the given
point. If the point is outside the cuboid, the returned point will be on the surface of the cuboid. Otherwise, it will be inside the cuboid and returned as is.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
new
Create a new
Cuboidfrom a full x, y, and z length
Arguments
| Name | Type | Documentation |
|---|---|---|
| x_length | f32 | No Documentation 🚧 |
| y_length | f32 | No Documentation 🚧 |
| z_length | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Cuboid | No Documentation 🚧 |
size
Get the size of the cuboid
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Cuboid | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_corners
Create a new
Cuboidfrom two corner points
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Cuboid | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Cuboid | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Cuboid | No Documentation 🚧 |
from_size
Create a new
Cuboidfrom a given full size
Arguments
| Name | Type | Documentation |
|---|---|---|
| size | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Cuboid | No Documentation 🚧 |
Cylinder
Cylinder
- radius:f32
- half_height:f32
Description
A cylinder primitive centered on the origin
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Create a new `Cylinder` from a radius and full height |
| base | Get the base of the cylinder as a [`Circle`] |
| base_area | Get the surface area of one base of the cylinder |
| eq | No Documentation 🚧 |
| lateral_area | Get the surface area of the side of the cylinder, also known as the lateral area |
| clone | No Documentation 🚧 |
new
Create a new
Cylinderfrom a radius and full height
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Cylinder | No Documentation 🚧 |
base
Get the base of the cylinder as a [
Circle]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Cylinder | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Circle | No Documentation 🚧 |
base_area
Get the surface area of one base of the cylinder
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Cylinder | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
lateral_area
Get the surface area of the side of the cylinder, also known as the lateral area
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Cylinder | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Cylinder | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Cylinder | No Documentation 🚧 |
InfinitePlane3d
InfinitePlane3d
- normal:bevy_math::direction::Dir3
Description
An unbounded plane in 3D space. It forms a separating surface through the origin, stretching infinitely far
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| isometry_into_xy | Computes an [`Isometry3d`] which transforms points from the plane in 3D space with the given `origin` to the XY-plane. ## Guarantees * the transformation is a [congruence]... |
| clone | No Documentation 🚧 |
| isometry_from_xy | Computes an [`Isometry3d`] which transforms points from the XY-plane to this plane with the given `origin`. ## Guarantees * the transformation is a [congruence]... |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | InfinitePlane3d | No Documentation 🚧 |
| other | InfinitePlane3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
isometry_into_xy
Computes an [
Isometry3d] which transforms points from the plane in 3D space with the givenoriginto the XY-plane.Guarantees
- the transformation is a [congruence] meaning it will preserve all distances and angles of the transformed geometry
- uses the least rotation possible to transform the geometry
- if two geometries are transformed with the same isometry, then the relations between them, like distances, are also preserved
- compared to projections, the transformation is lossless (up to floating point errors) reversible
Non-Guarantees
- the rotation used is generally not unique
- the orientation of the transformed geometry in the XY plane might be arbitrary, to enforce some kind of alignment the user has to use an extra transformation ontop of this one See [
isometries_xy] for example usescases. [congruence]: https://en.wikipedia.org/wiki/Congruence_(geometry) [isometries_xy]:InfinitePlane3d::isometries_xy
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | InfinitePlane3d | No Documentation 🚧 |
| origin | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | InfinitePlane3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | InfinitePlane3d | No Documentation 🚧 |
isometry_from_xy
Computes an [
Isometry3d] which transforms points from the XY-plane to this plane with the givenorigin.Guarantees
- the transformation is a [congruence] meaning it will preserve all distances and angles of the transformed geometry
- uses the least rotation possible to transform the geometry
- if two geometries are transformed with the same isometry, then the relations between them, like distances, are also preserved
- compared to projections, the transformation is lossless (up to floating point errors) reversible
Non-Guarantees
- the rotation used is generally not unique
- the orientation of the transformed geometry in the XY plane might be arbitrary, to enforce some kind of alignment the user has to use an extra transformation ontop of this one See [
isometries_xy] for example usescases. [congruence]: https://en.wikipedia.org/wiki/Congruence_(geometry) [isometries_xy]:InfinitePlane3d::isometries_xy
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | InfinitePlane3d | No Documentation 🚧 |
| origin | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
Line3d
Line3d
- direction:bevy_math::direction::Dir3
Description
An infinite line going through the origin along a direction in 3D space.
For a finite line: [
Segment3d]
Associated Functions
For function details and documentation, click on the function link.
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Line3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Line3d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
Plane3d
Plane3d
- normal:bevy_math::direction::Dir3
- half_size:glam::Vec2
Description
A bounded plane in 3D space. It forms a surface starting from the origin with a defined height and width.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| new | Create a new `Plane3d` from a normal and a half size # Panics Panics if the given `normal` is zer... |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Plane3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Plane3d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Create a new
Plane3dfrom a normal and a half sizePanics
Panics if the given
normalis zero (or very close to zero), or non-finite.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Plane3d | No Documentation 🚧 |
Segment3d
Segment3d
- vertices:[glam::Vec3; 2]
Description
A line segment defined by two endpoints in 3D space.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| scaled_direction | Compute the vector from the first endpoint to the second endpoint. |
| reversed | Returns the line segment with its direction reversed by swapping the endpoints. |
| point2 | Get the position of the second endpoint of the line segment. |
| centered | Compute the segment with its center at the origin, keeping the same direction and length. |
| length | Compute the length of the line segment. |
| reverse | Reverses the direction of the line segment by swapping the endpoints. |
| resized | Compute the segment with a new length, keeping the same direction and center. |
| point1 | Get the position of the first endpoint of the line segment. |
| clone | No Documentation 🚧 |
| from_ray_and_length | Create a new `Segment3d` starting from the origin of the given `ray`, going in the direction of th... |
| rotated_around_center | Compute the segment rotated around its own center. |
| from_scaled_direction | Create a new `Segment3d` centered at the origin from a vector representing the direction and lengt... |
| translated | Compute the segment translated by the given vector. |
| center | Compute the midpoint between the two endpoints of the line segment. |
| from_direction_and_length | Create a new `Segment3d` centered at the origin with the given direction and length. The endpoints... |
| rotated | Compute the segment rotated around the origin by the given rotation. |
| length_squared | Compute the squared length of the line segment. |
| new | Create a new `Segment3d` from its endpoints. |
| eq | No Documentation 🚧 |
| rotated_around | Compute the segment rotated around the given point by the given rotation. |
| direction | Compute the normalized direction pointing from the first endpoint to the second endpoint. For the ... |
scaled_direction
Compute the vector from the first endpoint to the second endpoint.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
reversed
Returns the line segment with its direction reversed by swapping the endpoints.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment3d | No Documentation 🚧 |
point2
Get the position of the second endpoint of the line segment.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
centered
Compute the segment with its center at the origin, keeping the same direction and length.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment3d | No Documentation 🚧 |
length
Compute the length of the line segment.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
reverse
Reverses the direction of the line segment by swapping the endpoints.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
resized
Compute the segment with a new length, keeping the same direction and center.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment3d | No Documentation 🚧 |
point1
Get the position of the first endpoint of the line segment.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment3d | No Documentation 🚧 |
from_ray_and_length
Create a new
Segment3dstarting from the origin of the givenray, going in the direction of the ray for the givenlength. The endpoints will be atray.originandray.origin + length * ray.direction.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment3d | No Documentation 🚧 |
rotated_around_center
Compute the segment rotated around its own center.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment3d | No Documentation 🚧 |
from_scaled_direction
Create a new
Segment3dcentered at the origin from a vector representing the direction and length of the line segment. The endpoints will be at-scaled_direction / 2.0andscaled_direction / 2.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scaled_direction | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment3d | No Documentation 🚧 |
translated
Compute the segment translated by the given vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment3d | No Documentation 🚧 |
center
Compute the midpoint between the two endpoints of the line segment.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
from_direction_and_length
Create a new
Segment3dcentered at the origin with the given direction and length. The endpoints will be at-direction * length / 2.0anddirection * length / 2.0.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment3d | No Documentation 🚧 |
rotated
Compute the segment rotated around the origin by the given rotation.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment3d | No Documentation 🚧 |
length_squared
Compute the squared length of the line segment.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
new
Create a new
Segment3dfrom its endpoints.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment3d | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
rotated_around
Compute the segment rotated around the given point by the given rotation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment3d | No Documentation 🚧 |
| rotation | Quat | No Documentation 🚧 |
| point | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Segment3d | No Documentation 🚧 |
direction
Compute the normalized direction pointing from the first endpoint to the second endpoint. For the non-panicking version, see [
Segment3d::try_direction].Panics
Panics if a valid direction could not be computed, for example when the endpoints are coincident, NaN, or infinite.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Segment3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
Sphere
Sphere
- radius:f32
Description
A sphere primitive, representing the set of all points some distance from the origin
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| closest_point | Finds the point on the sphere that is closest to the given `point`. If the point is outside the sp... |
| diameter | Get the diameter of the sphere |
| clone | No Documentation 🚧 |
| new | Create a new [`Sphere`] from a `radius` |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
closest_point
Finds the point on the sphere that is closest to the given
point. If the point is outside the sphere, the returned point will be on the surface of the sphere. Otherwise, it will be inside the sphere and returned as is.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
diameter
Get the diameter of the sphere
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Sphere | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Sphere | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Sphere | No Documentation 🚧 |
new
Create a new [
Sphere] from aradius
Arguments
| Name | Type | Documentation |
|---|---|---|
| radius | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Sphere | No Documentation 🚧 |
Tetrahedron
Tetrahedron
- vertices:[glam::Vec3; 4]
Description
A tetrahedron primitive.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| signed_volume | Get the signed volume of the tetrahedron. If it's negative, the normal vector of the face defined ... |
| eq | No Documentation 🚧 |
| new | Create a new [`Tetrahedron`] from points `a`, `b`, `c` and `d`. |
| clone | No Documentation 🚧 |
| centroid | Get the centroid of the tetrahedron. This function finds the geometric center of the tetrahedron ... |
signed_volume
Get the signed volume of the tetrahedron. If it's negative, the normal vector of the face defined by the first three points using the right-hand rule points away from the fourth vertex.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Tetrahedron | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Tetrahedron | No Documentation 🚧 |
| other | Tetrahedron | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Create a new [
Tetrahedron] from pointsa,b,candd.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | Vec3 | No Documentation 🚧 |
| b | Vec3 | No Documentation 🚧 |
| c | Vec3 | No Documentation 🚧 |
| d | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Tetrahedron | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Tetrahedron | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Tetrahedron | No Documentation 🚧 |
centroid
Get the centroid of the tetrahedron. This function finds the geometric center of the tetrahedron by averaging the vertices:
centroid = (a + b + c + d) / 4.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Tetrahedron | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
Torus
Torus
- minor_radius:f32
- major_radius:f32
Description
A torus primitive, often representing a ring or donut shape The set of points some distance from a circle centered at the origin
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| outer_radius | Get the outer radius of the torus. This corresponds to the overall radius of the entire object, o... |
| inner_radius | Get the inner radius of the torus. For a ring torus, this corresponds to the radius of the hole, ... |
| clone | No Documentation 🚧 |
| new | Create a new `Torus` from an inner and outer radius. The inner radius is the radius of the hole, a... |
| eq | No Documentation 🚧 |
outer_radius
Get the outer radius of the torus. This corresponds to the overall radius of the entire object, or
major_radius + minor_radius
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Torus | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
inner_radius
Get the inner radius of the torus. For a ring torus, this corresponds to the radius of the hole, or
major_radius - minor_radius
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Torus | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Torus | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Torus | No Documentation 🚧 |
new
Create a new
Torusfrom an inner and outer radius. The inner radius is the radius of the hole, and the outer radius is the radius of the entire object
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Torus | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
Triangle3d
Triangle3d
- vertices:[glam::Vec3; 3]
Description
A 3D triangle primitive.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| is_degenerate | Checks if the triangle is degenerate, meaning it has zero area. A triangle is degenerate if the cr... |
| is_obtuse | Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees |
| reverse | Reverse the triangle by swapping the first and last vertices. |
| eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| is_acute | Checks if the triangle is acute, meaning all angles are less than 90 degrees |
| new | Create a new [`Triangle3d`] from points `a`, `b`, and `c`. |
| circumcenter | Get the circumcenter of the triangle. |
| reversed | This triangle but reversed. |
| centroid | Get the centroid of the triangle. This function finds the geometric center of the triangle by aver... |
is_degenerate
Checks if the triangle is degenerate, meaning it has zero area. A triangle is degenerate if the cross product of the vectors
abandachas a length less than10e-7. This indicates that the three vertices are collinear or nearly collinear.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_obtuse
Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
reverse
Reverse the triangle by swapping the first and last vertices.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle3d | No Documentation 🚧 |
| other | Triangle3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Triangle3d | No Documentation 🚧 |
is_acute
Checks if the triangle is acute, meaning all angles are less than 90 degrees
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Create a new [
Triangle3d] from pointsa,b, andc.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Triangle3d | No Documentation 🚧 |
circumcenter
Get the circumcenter of the triangle.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
reversed
This triangle but reversed.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Triangle3d | No Documentation 🚧 |
centroid
Get the centroid of the triangle. This function finds the geometric center of the triangle by averaging the vertices:
centroid = (a + b + c) / 3.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Triangle3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
Ray2d
Ray2d
- origin:glam::Vec2
- direction:bevy_math::direction::Dir2
Description
An infinite half-line starting at
originand going indirectionin 2D space.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| get_point | Get a point at a given distance along the ray |
| intersect_plane | Get the distance to a plane if the ray intersects it |
| eq | No Documentation 🚧 |
| new | Create a new `Ray2d` from a given origin and direction |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Ray2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Ray2d | No Documentation 🚧 |
get_point
Get a point at a given distance along the ray
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
intersect_plane
Get the distance to a plane if the ray intersects it
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Ray2d | No Documentation 🚧 |
| plane_origin | Vec2 | No Documentation 🚧 |
| plane | Plane2d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<f32> | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Create a new
Ray2dfrom a given origin and direction
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Ray2d | No Documentation 🚧 |
Ray3d
Ray3d
- origin:glam::Vec3
- direction:bevy_math::direction::Dir3
Description
An infinite half-line starting at
originand going indirectionin 3D space.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| get_point | Get a point at a given distance along the ray |
| eq | No Documentation 🚧 |
| new | Create a new `Ray3d` from a given origin and direction |
| intersect_plane | Get the distance to a plane if the ray intersects it |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Ray3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Ray3d | No Documentation 🚧 |
get_point
Get a point at a given distance along the ray
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Create a new
Ray3dfrom a given origin and direction
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Ray3d | No Documentation 🚧 |
intersect_plane
Get the distance to a plane if the ray intersects it
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Ray3d | No Documentation 🚧 |
| plane_origin | Vec3 | No Documentation 🚧 |
| plane | InfinitePlane3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<f32> | No Documentation 🚧 |
IRect
IRect
- min:glam::IVec2
- max:glam::IVec2
Description
A rectangle defined by two opposite corners.
The rectangle is axis aligned, and defined by its minimum and maximum coordinates, stored in
IRect::minandIRect::max, respectively. The minimum/maximum invariant must be upheld by the user when directly assigning the fields, otherwise some methods produce invalid results. It is generally recommended to use one of the constructor methods instead, which will ensure this invariant is met, unless you already have the minimum and maximum corners.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| inflate | Create a new rectangle by expanding it evenly on all sides. A positive expansion value produces a ... |
| from_corners | Create a new rectangle from two corner points. The two points do not need to be the minimum and/or... |
| from_center_half_size | Create a new rectangle from its center and half-size. # Panics This method panics if any of the c... |
| contains | Check if a point lies within this rectangle, inclusive of its edges. # Examples ``` # use bevy_math::IRect; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 assert!(r.contains(r.center())); assert!(r.contains(r.min)); assert!(r.contains(r.max)); ``` |
| as_urect | Returns self as [`URect`] (u32) |
| new | Create a new rectangle from two corner points. The two points do not need to be the minimum and/or... |
| union | Build a new rectangle formed of the union of this rectangle and another rectangle. The union is th... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| center | The center point of the rectangle. # Rounding Behavior If the (min + max) contains odd numbers th... |
| from_center_size | Create a new rectangle from its center and size. # Rounding Behavior If the size contains odd num... |
| width | Rectangle width (max.x - min.x). # Examples ``` # use bevy_math::IRect; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.width(), 5); `... |
| union_point | Build a new rectangle formed of the union of this rectangle and a point. The union is the smallest... |
| size | Rectangle size. # Examples ``` # use bevy_math::{IRect, IVec2}; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.size(), IVec2::new(5, 1)); `... |
| as_rect | Returns self as [`Rect`] (f32) |
| half_size | Rectangle half-size. # Rounding Behavior If the full size contains odd numbers they will be round... |
| intersect | Build a new rectangle formed of the intersection of this rectangle and another rectangle. The inte... |
| eq | No Documentation 🚧 |
| is_empty | Check if the rectangle is empty. # Examples ``` # use bevy_math::{IRect, IVec2}; let r = IRect::from_corners(IVec2::ZERO, IVec2::new(0, 1)); // w=0 h=1 assert!(r.is_empty()); ``` |
| clone | No Documentation 🚧 |
| height | Rectangle height (max.y - min.y). # Examples ``` # use bevy_math::IRect; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.height(), 1); `... |
inflate
Create a new rectangle by expanding it evenly on all sides. A positive expansion value produces a larger rectangle, while a negative expansion value produces a smaller rectangle. If this would result in zero or negative width or height, [
IRect::EMPTY] is returned instead.Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 let r2 = r.inflate(3); // w=11 h=7 assert_eq!(r2.min, IVec2::splat(-3)); assert_eq!(r2.max, IVec2::new(8, 4)); let r = IRect::new(0, -1, 4, 3); // w=4 h=4 let r2 = r.inflate(-1); // w=2 h=2 assert_eq!(r2.min, IVec2::new(1, 0)); assert_eq!(r2.max, IVec2::new(3, 2));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IRect | No Documentation 🚧 |
from_corners
Create a new rectangle from two corner points. The two points do not need to be the minimum and/or maximum corners. They only need to be two opposite corners.
Examples
# use bevy_math::{IRect, IVec2}; // Unit rect from [0,0] to [1,1] let r = IRect::from_corners(IVec2::ZERO, IVec2::ONE); // w=1 h=1 // Same; the points do not need to be ordered let r = IRect::from_corners(IVec2::ONE, IVec2::ZERO); // w=1 h=1
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IRect | No Documentation 🚧 |
from_center_half_size
Create a new rectangle from its center and half-size.
Panics
This method panics if any of the components of the half-size is negative.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::from_center_half_size(IVec2::ZERO, IVec2::ONE); // w=2 h=2 assert_eq!(r.min, IVec2::splat(-1)); assert_eq!(r.max, IVec2::splat(1));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IRect | No Documentation 🚧 |
contains
Check if a point lies within this rectangle, inclusive of its edges.
Examples
# use bevy_math::IRect; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 assert!(r.contains(r.center())); assert!(r.contains(r.min)); assert!(r.contains(r.max));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_urect
Returns self as [
URect] (u32)
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IRect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | URect | No Documentation 🚧 |
new
Create a new rectangle from two corner points. The two points do not need to be the minimum and/or maximum corners. They only need to be two opposite corners.
Examples
# use bevy_math::IRect; let r = IRect::new(0, 4, 10, 6); // w=10 h=2 let r = IRect::new(2, 3, 5, -1); // w=3 h=4
Arguments
| Name | Type | Documentation |
|---|---|---|
| x0 | i32 | No Documentation 🚧 |
| y0 | i32 | No Documentation 🚧 |
| x1 | i32 | No Documentation 🚧 |
| y1 | i32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IRect | No Documentation 🚧 |
union
Build a new rectangle formed of the union of this rectangle and another rectangle. The union is the smallest rectangle enclosing both rectangles.
Examples
# use bevy_math::{IRect, IVec2}; let r1 = IRect::new(0, 0, 5, 1); // w=5 h=1 let r2 = IRect::new(1, -1, 3, 3); // w=2 h=4 let r = r1.union(r2); assert_eq!(r.min, IVec2::new(0, -1)); assert_eq!(r.max, IVec2::new(5, 3));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IRect | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IRect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
center
The center point of the rectangle.
Rounding Behavior
If the (min + max) contains odd numbers they will be rounded down to the nearest whole number when calculating the center.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::new(0, 0, 5, 2); // w=5 h=2 assert_eq!(r.center(), IVec2::new(2, 1));
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IRect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
from_center_size
Create a new rectangle from its center and size.
Rounding Behavior
If the size contains odd numbers they will be rounded down to the nearest whole number.
Panics
This method panics if any of the components of the size is negative.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::from_center_size(IVec2::ZERO, IVec2::new(3, 2)); // w=2 h=2 assert_eq!(r.min, IVec2::splat(-1)); assert_eq!(r.max, IVec2::splat(1));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IRect | No Documentation 🚧 |
width
Rectangle width (max.x - min.x).
Examples
# use bevy_math::IRect; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.width(), 5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IRect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
union_point
Build a new rectangle formed of the union of this rectangle and a point. The union is the smallest rectangle enclosing both the rectangle and the point. If the point is already inside the rectangle, this method returns a copy of the rectangle.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 let u = r.union_point(IVec2::new(3, 6)); assert_eq!(u.min, IVec2::ZERO); assert_eq!(u.max, IVec2::new(5, 6));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IRect | No Documentation 🚧 |
size
Rectangle size.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.size(), IVec2::new(5, 1));
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IRect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
as_rect
Returns self as [
Rect] (f32)
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IRect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rect | No Documentation 🚧 |
half_size
Rectangle half-size.
Rounding Behavior
If the full size contains odd numbers they will be rounded down to the nearest whole number when calculating the half size.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::new(0, 0, 4, 3); // w=4 h=3 assert_eq!(r.half_size(), IVec2::new(2, 1));
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IRect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
intersect
Build a new rectangle formed of the intersection of this rectangle and another rectangle. The intersection is the largest rectangle enclosed in both rectangles. If the intersection is empty, this method returns an empty rectangle ([
IRect::is_empty()] returnstrue), but the actual values of [IRect::min] and [IRect::max] are implementation-dependent.Examples
# use bevy_math::{IRect, IVec2}; let r1 = IRect::new(0, 0, 5, 1); // w=5 h=1 let r2 = IRect::new(1, -1, 3, 3); // w=2 h=4 let r = r1.intersect(r2); assert_eq!(r.min, IVec2::new(1, 0)); assert_eq!(r.max, IVec2::new(3, 1));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IRect | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_empty
Check if the rectangle is empty.
Examples
# use bevy_math::{IRect, IVec2}; let r = IRect::from_corners(IVec2::ZERO, IVec2::new(0, 1)); // w=0 h=1 assert!(r.is_empty());
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IRect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IRect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IRect | No Documentation 🚧 |
height
Rectangle height (max.y - min.y).
Examples
# use bevy_math::IRect; let r = IRect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.height(), 1);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IRect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
Rect
Rect
- min:glam::Vec2
- max:glam::Vec2
Description
A rectangle defined by two opposite corners.
The rectangle is axis aligned, and defined by its minimum and maximum coordinates, stored in
Rect::minandRect::max, respectively. The minimum/maximum invariant must be upheld by the user when directly assigning the fields, otherwise some methods produce invalid results. It is generally recommended to use one of the constructor methods instead, which will ensure this invariant is met, unless you already have the minimum and maximum corners.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| as_urect | Returns self as [`URect`] (u32) |
| from_corners | Create a new rectangle from two corner points. The two points do not need to be the minimum and/or... |
| half_size | Rectangle half-size. # Examples ``` # use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!(r.half_size().abs_diff_eq(Vec2::new(2.5, 0.5), 1e-5)); `... |
| is_empty | Check if the rectangle is empty. # Examples ``` # use bevy_math::{Rect, Vec2}; let r = Rect::from_corners(Vec2::ZERO, Vec2::new(0., 1.)); // w=0 h=1 assert!(r.is_empty()); ``` |
| as_irect | Returns self as [`IRect`] (i32) |
| union | Build a new rectangle formed of the union of this rectangle and another rectangle. The union is th... |
| size | Rectangle size. # Examples ``` # use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!(r.size().abs_diff_eq(Vec2::new(5., 1.), 1e-5)); ``` |
| union_point | Build a new rectangle formed of the union of this rectangle and a point. The union is the smallest... |
| from_center_size | Create a new rectangle from its center and size. # Panics This method panics if any of the compon... |
| inflate | Create a new rectangle by expanding it evenly on all sides. A positive expansion value produces a ... |
| width | Rectangle width (max.x - min.x). # Examples ``` # use bevy_math::Rect; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!((r.width() - 5.).abs() <= 1e-5); ``` |
| from_center_half_size | Create a new rectangle from its center and half-size. # Panics This method panics if any of the c... |
| normalize | Build a new rectangle from this one with its coordinates expressed relative to `other` in a normal... |
| eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| center | The center point of the rectangle. # Examples ``` # use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!(r.center().abs_diff_eq(Vec2::new(2.5, 0.5), 1e-5)); ``` |
| contains | Check if a point lies within this rectangle, inclusive of its edges. # Examples ``` # use bevy_math::Rect; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!(r.contains(r.center())); assert!(r.contains(r.min)); assert!(r.contains(r.max)); ``` |
| height | Rectangle height (max.y - min.y). # Examples ``` # use bevy_math::Rect; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!((r.height() - 1.).abs() <= 1e-5); ``` |
| new | Create a new rectangle from two corner points. The two points do not need to be the minimum and/or... |
| intersect | Build a new rectangle formed of the intersection of this rectangle and another rectangle. The inte... |
as_urect
Returns self as [
URect] (u32)
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | URect | No Documentation 🚧 |
from_corners
Create a new rectangle from two corner points. The two points do not need to be the minimum and/or maximum corners. They only need to be two opposite corners.
Examples
# use bevy_math::{Rect, Vec2}; // Unit rect from [0,0] to [1,1] let r = Rect::from_corners(Vec2::ZERO, Vec2::ONE); // w=1 h=1 // Same; the points do not need to be ordered let r = Rect::from_corners(Vec2::ONE, Vec2::ZERO); // w=1 h=1
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rect | No Documentation 🚧 |
half_size
Rectangle half-size.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!(r.half_size().abs_diff_eq(Vec2::new(2.5, 0.5), 1e-5));
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
is_empty
Check if the rectangle is empty.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::from_corners(Vec2::ZERO, Vec2::new(0., 1.)); // w=0 h=1 assert!(r.is_empty());
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_irect
Returns self as [
IRect] (i32)
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IRect | No Documentation 🚧 |
union
Build a new rectangle formed of the union of this rectangle and another rectangle. The union is the smallest rectangle enclosing both rectangles.
Examples
# use bevy_math::{Rect, Vec2}; let r1 = Rect::new(0., 0., 5., 1.); // w=5 h=1 let r2 = Rect::new(1., -1., 3., 3.); // w=2 h=4 let r = r1.union(r2); assert!(r.min.abs_diff_eq(Vec2::new(0., -1.), 1e-5)); assert!(r.max.abs_diff_eq(Vec2::new(5., 3.), 1e-5));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rect | No Documentation 🚧 |
size
Rectangle size.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!(r.size().abs_diff_eq(Vec2::new(5., 1.), 1e-5));
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
union_point
Build a new rectangle formed of the union of this rectangle and a point. The union is the smallest rectangle enclosing both the rectangle and the point. If the point is already inside the rectangle, this method returns a copy of the rectangle.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 let u = r.union_point(Vec2::new(3., 6.)); assert!(u.min.abs_diff_eq(Vec2::ZERO, 1e-5)); assert!(u.max.abs_diff_eq(Vec2::new(5., 6.), 1e-5));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rect | No Documentation 🚧 |
from_center_size
Create a new rectangle from its center and size.
Panics
This method panics if any of the components of the size is negative.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::from_center_size(Vec2::ZERO, Vec2::ONE); // w=1 h=1 assert!(r.min.abs_diff_eq(Vec2::splat(-0.5), 1e-5)); assert!(r.max.abs_diff_eq(Vec2::splat(0.5), 1e-5));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rect | No Documentation 🚧 |
inflate
Create a new rectangle by expanding it evenly on all sides. A positive expansion value produces a larger rectangle, while a negative expansion value produces a smaller rectangle. If this would result in zero or negative width or height, [
Rect::EMPTY] is returned instead.Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 let r2 = r.inflate(3.); // w=11 h=7 assert!(r2.min.abs_diff_eq(Vec2::splat(-3.), 1e-5)); assert!(r2.max.abs_diff_eq(Vec2::new(8., 4.), 1e-5)); let r = Rect::new(0., -1., 6., 7.); // w=6 h=8 let r2 = r.inflate(-2.); // w=11 h=7 assert!(r2.min.abs_diff_eq(Vec2::new(2., 1.), 1e-5)); assert!(r2.max.abs_diff_eq(Vec2::new(4., 5.), 1e-5));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rect | No Documentation 🚧 |
width
Rectangle width (max.x - min.x).
Examples
# use bevy_math::Rect; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!((r.width() - 5.).abs() <= 1e-5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_center_half_size
Create a new rectangle from its center and half-size.
Panics
This method panics if any of the components of the half-size is negative.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::from_center_half_size(Vec2::ZERO, Vec2::ONE); // w=2 h=2 assert!(r.min.abs_diff_eq(Vec2::splat(-1.), 1e-5)); assert!(r.max.abs_diff_eq(Vec2::splat(1.), 1e-5));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rect | No Documentation 🚧 |
normalize
Build a new rectangle from this one with its coordinates expressed relative to
otherin a normalized ([0..1] x [0..1]) coordinate system.Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::new(2., 3., 4., 6.); let s = Rect::new(0., 0., 10., 10.); let n = r.normalize(s); assert_eq!(n.min.x, 0.2); assert_eq!(n.min.y, 0.3); assert_eq!(n.max.x, 0.4); assert_eq!(n.max.y, 0.6);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rect | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rect | No Documentation 🚧 |
center
The center point of the rectangle.
Examples
# use bevy_math::{Rect, Vec2}; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!(r.center().abs_diff_eq(Vec2::new(2.5, 0.5), 1e-5));
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
contains
Check if a point lies within this rectangle, inclusive of its edges.
Examples
# use bevy_math::Rect; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!(r.contains(r.center())); assert!(r.contains(r.min)); assert!(r.contains(r.max));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
height
Rectangle height (max.y - min.y).
Examples
# use bevy_math::Rect; let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 assert!((r.height() - 1.).abs() <= 1e-5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
new
Create a new rectangle from two corner points. The two points do not need to be the minimum and/or maximum corners. They only need to be two opposite corners.
Examples
# use bevy_math::Rect; let r = Rect::new(0., 4., 10., 6.); // w=10 h=2 let r = Rect::new(2., 3., 5., -1.); // w=3 h=4
Arguments
| Name | Type | Documentation |
|---|---|---|
| x0 | f32 | No Documentation 🚧 |
| y0 | f32 | No Documentation 🚧 |
| x1 | f32 | No Documentation 🚧 |
| y1 | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rect | No Documentation 🚧 |
intersect
Build a new rectangle formed of the intersection of this rectangle and another rectangle. The intersection is the largest rectangle enclosed in both rectangles. If the intersection is empty, this method returns an empty rectangle ([
Rect::is_empty()] returnstrue), but the actual values of [Rect::min] and [Rect::max] are implementation-dependent.Examples
# use bevy_math::{Rect, Vec2}; let r1 = Rect::new(0., 0., 5., 1.); // w=5 h=1 let r2 = Rect::new(1., -1., 3., 3.); // w=2 h=4 let r = r1.intersect(r2); assert!(r.min.abs_diff_eq(Vec2::new(1., 0.), 1e-5)); assert!(r.max.abs_diff_eq(Vec2::new(3., 1.), 1e-5));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rect | No Documentation 🚧 |
URect
URect
- min:glam::UVec2
- max:glam::UVec2
Description
A rectangle defined by two opposite corners.
The rectangle is axis aligned, and defined by its minimum and maximum coordinates, stored in
URect::minandURect::max, respectively. The minimum/maximum invariant must be upheld by the user when directly assigning the fields, otherwise some methods produce invalid results. It is generally recommended to use one of the constructor methods instead, which will ensure this invariant is met, unless you already have the minimum and maximum corners.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
| size | Rectangle size. # Examples ``` # use bevy_math::{URect, UVec2}; let r = URect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.size(), UVec2::new(5, 1)); `... |
| as_rect | Returns self as [`Rect`] (f32) |
| half_size | Rectangle half-size. # Rounding Behavior If the full size contains odd numbers they will be round... |
| height | Rectangle height (max.y - min.y). # Examples ``` # use bevy_math::URect; let r = URect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.height(), 1); `... |
| eq | No Documentation 🚧 |
| as_irect | Returns self as [`IRect`] (i32) |
| from_center_half_size | Create a new rectangle from its center and half-size. # Panics This method panics if any of the c... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| intersect | Build a new rectangle formed of the intersection of this rectangle and another rectangle. The inte... |
| new | Create a new rectangle from two corner points. The two points do not need to be the minimum and/or... |
| union | Build a new rectangle formed of the union of this rectangle and another rectangle. The union is th... |
| is_empty | Check if the rectangle is empty. # Examples ``` # use bevy_math::{URect, UVec2}; let r = URect::from_corners(UVec2::ZERO, UVec2::new(0, 1)); // w=0 h=1 assert!(r.is_empty()); ``` |
| inflate | Create a new rectangle by expanding it evenly on all sides. A positive expansion value produces a ... |
| contains | Check if a point lies within this rectangle, inclusive of its edges. # Examples ``` # use bevy_math::URect; let r = URect::new(0, 0, 5, 1); // w=5 h=1 assert!(r.contains(r.center())); assert!(r.contains(r.min)); assert!(r.contains(r.max)); ``` |
| union_point | Build a new rectangle formed of the union of this rectangle and a point. The union is the smallest... |
| from_corners | Create a new rectangle from two corner points. The two points do not need to be the minimum and/or... |
| from_center_size | Create a new rectangle from its center and size. # Rounding Behavior If the size contains odd num... |
| center | The center point of the rectangle. # Rounding Behavior If the (min + max) contains odd numbers th... |
| width | Rectangle width (max.x - min.x). # Examples ``` # use bevy_math::URect; let r = URect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.width(), 5); `... |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | URect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | URect | No Documentation 🚧 |
size
Rectangle size.
Examples
# use bevy_math::{URect, UVec2}; let r = URect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.size(), UVec2::new(5, 1));
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | URect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
as_rect
Returns self as [
Rect] (f32)
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | URect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rect | No Documentation 🚧 |
half_size
Rectangle half-size.
Rounding Behavior
If the full size contains odd numbers they will be rounded down to the nearest whole number when calculating the half size.
Examples
# use bevy_math::{URect, UVec2}; let r = URect::new(0, 0, 4, 2); // w=4 h=2 assert_eq!(r.half_size(), UVec2::new(2, 1));
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | URect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
height
Rectangle height (max.y - min.y).
Examples
# use bevy_math::URect; let r = URect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.height(), 1);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | URect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_irect
Returns self as [
IRect] (i32)
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | URect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IRect | No Documentation 🚧 |
from_center_half_size
Create a new rectangle from its center and half-size.
Panics
This method panics if any of the components of the half-size is negative or if
origin - half_sizeresults in any negatives.Examples
# use bevy_math::{URect, UVec2}; let r = URect::from_center_half_size(UVec2::ONE, UVec2::ONE); // w=2 h=2 assert_eq!(r.min, UVec2::splat(0)); assert_eq!(r.max, UVec2::splat(2));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | URect | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | URect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
intersect
Build a new rectangle formed of the intersection of this rectangle and another rectangle. The intersection is the largest rectangle enclosed in both rectangles. If the intersection is empty, this method returns an empty rectangle ([
URect::is_empty()] returnstrue), but the actual values of [URect::min] and [URect::max] are implementation-dependent.Examples
# use bevy_math::{URect, UVec2}; let r1 = URect::new(0, 0, 2, 2); // w=2 h=2 let r2 = URect::new(1, 1, 3, 3); // w=2 h=2 let r = r1.intersect(r2); assert_eq!(r.min, UVec2::new(1, 1)); assert_eq!(r.max, UVec2::new(2, 2));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | URect | No Documentation 🚧 |
new
Create a new rectangle from two corner points. The two points do not need to be the minimum and/or maximum corners. They only need to be two opposite corners.
Examples
# use bevy_math::URect; let r = URect::new(0, 4, 10, 6); // w=10 h=2 let r = URect::new(2, 4, 5, 0); // w=3 h=4
Arguments
| Name | Type | Documentation |
|---|---|---|
| x0 | u32 | No Documentation 🚧 |
| y0 | u32 | No Documentation 🚧 |
| x1 | u32 | No Documentation 🚧 |
| y1 | u32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | URect | No Documentation 🚧 |
union
Build a new rectangle formed of the union of this rectangle and another rectangle. The union is the smallest rectangle enclosing both rectangles.
Examples
# use bevy_math::{URect, UVec2}; let r1 = URect::new(0, 0, 5, 1); // w=5 h=1 let r2 = URect::new(1, 0, 3, 8); // w=2 h=4 let r = r1.union(r2); assert_eq!(r.min, UVec2::new(0, 0)); assert_eq!(r.max, UVec2::new(5, 8));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | URect | No Documentation 🚧 |
is_empty
Check if the rectangle is empty.
Examples
# use bevy_math::{URect, UVec2}; let r = URect::from_corners(UVec2::ZERO, UVec2::new(0, 1)); // w=0 h=1 assert!(r.is_empty());
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | URect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
inflate
Create a new rectangle by expanding it evenly on all sides. A positive expansion value produces a larger rectangle, while a negative expansion value produces a smaller rectangle. If this would result in zero width or height, [
URect::EMPTY] is returned instead.Examples
# use bevy_math::{URect, UVec2}; let r = URect::new(4, 4, 6, 6); // w=2 h=2 let r2 = r.inflate(1); // w=4 h=4 assert_eq!(r2.min, UVec2::splat(3)); assert_eq!(r2.max, UVec2::splat(7)); let r = URect::new(4, 4, 8, 8); // w=4 h=4 let r2 = r.inflate(-1); // w=2 h=2 assert_eq!(r2.min, UVec2::splat(5)); assert_eq!(r2.max, UVec2::splat(7));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | URect | No Documentation 🚧 |
contains
Check if a point lies within this rectangle, inclusive of its edges.
Examples
# use bevy_math::URect; let r = URect::new(0, 0, 5, 1); // w=5 h=1 assert!(r.contains(r.center())); assert!(r.contains(r.min)); assert!(r.contains(r.max));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
union_point
Build a new rectangle formed of the union of this rectangle and a point. The union is the smallest rectangle enclosing both the rectangle and the point. If the point is already inside the rectangle, this method returns a copy of the rectangle.
Examples
# use bevy_math::{URect, UVec2}; let r = URect::new(0, 0, 5, 1); // w=5 h=1 let u = r.union_point(UVec2::new(3, 6)); assert_eq!(u.min, UVec2::ZERO); assert_eq!(u.max, UVec2::new(5, 6));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | URect | No Documentation 🚧 |
from_corners
Create a new rectangle from two corner points. The two points do not need to be the minimum and/or maximum corners. They only need to be two opposite corners.
Examples
# use bevy_math::{URect, UVec2}; // Unit rect from [0,0] to [1,1] let r = URect::from_corners(UVec2::ZERO, UVec2::ONE); // w=1 h=1 // Same; the points do not need to be ordered let r = URect::from_corners(UVec2::ONE, UVec2::ZERO); // w=1 h=1
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | URect | No Documentation 🚧 |
from_center_size
Create a new rectangle from its center and size.
Rounding Behavior
If the size contains odd numbers they will be rounded down to the nearest whole number.
Panics
This method panics if any of the components of the size is negative or if
origin - (size / 2)results in any negatives.Examples
# use bevy_math::{URect, UVec2}; let r = URect::from_center_size(UVec2::ONE, UVec2::splat(2)); // w=2 h=2 assert_eq!(r.min, UVec2::splat(0)); assert_eq!(r.max, UVec2::splat(2));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | URect | No Documentation 🚧 |
center
The center point of the rectangle.
Rounding Behavior
If the (min + max) contains odd numbers they will be rounded down to the nearest whole number when calculating the center.
Examples
# use bevy_math::{URect, UVec2}; let r = URect::new(0, 0, 4, 2); // w=4 h=2 assert_eq!(r.center(), UVec2::new(2, 1));
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | URect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
width
Rectangle width (max.x - min.x).
Examples
# use bevy_math::URect; let r = URect::new(0, 0, 5, 1); // w=5 h=1 assert_eq!(r.width(), 5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | URect | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
Rot2
Rot2
- cos:f32
- sin:f32
Description
A counterclockwise 2D rotation.
Example
# use approx::assert_relative_eq; # use bevy_math::{Rot2, Vec2}; use std::f32::consts::PI; // Create rotations from radians or degrees let rotation1 = Rot2::radians(PI / 2.0); let rotation2 = Rot2::degrees(45.0); // Get the angle back as radians or degrees assert_eq!(rotation1.as_degrees(), 90.0); assert_eq!(rotation2.as_radians(), PI / 4.0); // "Add" rotations together using `*` #[cfg(feature = "approx")] assert_relative_eq!(rotation1 * rotation2, Rot2::degrees(135.0)); // Rotate vectors #[cfg(feature = "approx")] assert_relative_eq!(rotation1 * Vec2::X, Vec2::Y);
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| nlerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`, and normalizes th... |
| inverse | Returns the inverse of the rotation. This is also the conjugate of the unit complex number represe... |
| sin_cos | Returns the sine and cosine of the rotation angle in radians. |
| is_near_identity | Returns `true` if the rotation is near [`Rot2::IDENTITY`]. |
| normalize | Returns `self` with a length of `1.0`. Note that [`Rot2`] should typically already be normalized by design. Manual normalization is only needed when successive operations result in accumulated floating point error, or if the rotation was constructed with invalid values. # Panics Panics if `self` has a length of zero, NaN, or infinity when debug assertions are enabled. |
| is_normalized | Returns whether `self` has a length of `1.0` or not. Uses a precision threshold of approximately `1e-4`... |
| as_turn_fraction | Returns the rotation as a fraction of a full 360 degree turn. |
| is_nan | Returns `true` if the rotation is NaN. |
| clone | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| angle_to | Returns the angle in radians needed to make `self` and `other` coincide. |
| length_squared | Computes the squared length or norm of the complex number used to represent the rotation. This is ... |
| degrees | Creates a [`Rot2`] from a counterclockwise angle in degrees. # Note The input rotation will always be clamped to the range `(-180°, 180°]... |
| as_radians | Returns the rotation in radians in the `(-pi, pi]` range. |
| length_recip | Computes `1.0 / self.length()`. For valid results, `self` must _not_ have a length of zero. |
| from_sin_cos | Creates a [`Rot2`] from the sine and cosine of an angle in radians. The rotation is only valid if `sin * sin + cos * cos == 1.0`. # Panics Panics if `sin * sin + cos * cos != 1.0` when the `glam_assert` feature is enabled. |
| fast_renormalize | Returns `self` after an approximate normalization, assuming the value is already nearly normalized.... |
| mul-2 | No Documentation 🚧 |
| turn_fraction | Creates a [`Rot2`] from a counterclockwise fraction of a full turn of 360 degrees. # Note The input rotation will always be clamped to the range `(-50%, 50%]... |
| slerp | Performs a spherical linear interpolation between `self` and `end` based on the value `s`. This c... |
| as_degrees | Returns the rotation in degrees in the `(-180, 180]` range. |
| mul-1 | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| length | Computes the length or norm of the complex number used to represent the rotation. The length is ty... |
| is_finite | Returns `true` if the rotation is neither infinite nor NaN. |
| radians | Creates a [`Rot2`] from a counterclockwise angle in radians. # Note The input rotation will always be clamped to the range `(-π, π]... |
nlerp
Performs a linear interpolation between
selfandrhsbased on the values, and normalizes the rotation afterwards. Whens == 0.0, the result will be equal toself. Whens == 1.0, the result will be equal torhs. This is slightly more efficient thanslerp, and produces a similar result when the difference between the two rotations is small. At larger differences, the result resembles a kind of ease-in-out effect. If you would like the angular velocity to remain constant, consider usingslerpinstead.Details
nlerpcorresponds to computing an angle for a point at positionson a line drawn between the endpoints of the arc formed byselfandrhson a unit circle, and normalizing the result afterwards. Note that if the angles are opposite like 0 and π, the line will pass through the origin, and the resulting angle will always be eitherselforrhsdepending ons. Ifshappens to be0.5in this case, a valid rotation cannot be computed, andselfwill be returned as a fallback.Example
# use bevy_math::Rot2; # let rot1 = Rot2::IDENTITY; let rot2 = Rot2::degrees(135.0); let result1 = rot1.nlerp(rot2, 1.0 / 3.0); assert_eq!(result1.as_degrees(), 28.675055); let result2 = rot1.nlerp(rot2, 0.5); assert_eq!(result2.as_degrees(), 67.5);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
inverse
Returns the inverse of the rotation. This is also the conjugate of the unit complex number representing the rotation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
sin_cos
Returns the sine and cosine of the rotation angle in radians.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
is_near_identity
Returns
trueif the rotation is near [Rot2::IDENTITY].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
normalize
Returns
selfwith a length of1.0. Note that [Rot2] should typically already be normalized by design. Manual normalization is only needed when successive operations result in accumulated floating point error, or if the rotation was constructed with invalid values.Panics
Panics if
selfhas a length of zero, NaN, or infinity when debug assertions are enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
is_normalized
Returns whether
selfhas a length of1.0or not. Uses a precision threshold of approximately1e-4.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_turn_fraction
Returns the rotation as a fraction of a full 360 degree turn.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
is_nan
Returns
trueif the rotation is NaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
angle_to
Returns the angle in radians needed to make
selfandothercoincide.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
length_squared
Computes the squared length or norm of the complex number used to represent the rotation. This is generally faster than [
Rot2::length()], as it avoids a square root operation. The length is typically expected to be1.0. Unexpectedly denormalized rotations can be a result of incorrect construction or floating point error caused by successive operations.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
degrees
Creates a [
Rot2] from a counterclockwise angle in degrees.Note
The input rotation will always be clamped to the range
(-180°, 180°]by design.Example
# use bevy_math::Rot2; # use approx::assert_relative_eq; let rot1 = Rot2::degrees(270.0); let rot2 = Rot2::degrees(-90.0); #[cfg(feature = "approx")] assert_relative_eq!(rot1, rot2); let rot3 = Rot2::degrees(180.0); #[cfg(feature = "approx")] assert_relative_eq!(rot1 * rot1, rot3);
Arguments
| Name | Type | Documentation |
|---|---|---|
| degrees | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
as_radians
Returns the rotation in radians in the
(-pi, pi]range.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
length_recip
Computes
1.0 / self.length(). For valid results,selfmust not have a length of zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_sin_cos
Creates a [
Rot2] from the sine and cosine of an angle in radians. The rotation is only valid ifsin * sin + cos * cos == 1.0.Panics
Panics if
sin * sin + cos * cos != 1.0when theglam_assertfeature is enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
fast_renormalize
Returns
selfafter an approximate normalization, assuming the value is already nearly normalized. Useful for preventing numerical error accumulation. SeeDir3::fast_renormalizefor an example of when such error accumulation might occur.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
turn_fraction
Creates a [
Rot2] from a counterclockwise fraction of a full turn of 360 degrees.Note
The input rotation will always be clamped to the range
(-50%, 50%]by design.Example
# use bevy_math::Rot2; # use approx::assert_relative_eq; let rot1 = Rot2::turn_fraction(0.75); let rot2 = Rot2::turn_fraction(-0.25); #[cfg(feature = "approx")] assert_relative_eq!(rot1, rot2); let rot3 = Rot2::turn_fraction(0.5); #[cfg(feature = "approx")] assert_relative_eq!(rot1 * rot1, rot3);
Arguments
| Name | Type | Documentation |
|---|---|---|
| fraction | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
slerp
Performs a spherical linear interpolation between
selfandendbased on the values. This corresponds to interpolating between the two angles at a constant angular velocity. Whens == 0.0, the result will be equal toself. Whens == 1.0, the result will be equal torhs. If you would like the rotation to have a kind of ease-in-out effect, consider using the slightly more efficientnlerpinstead.Example
# use bevy_math::Rot2; # let rot1 = Rot2::IDENTITY; let rot2 = Rot2::degrees(135.0); let result1 = rot1.slerp(rot2, 1.0 / 3.0); assert_eq!(result1.as_degrees(), 45.0); let result2 = rot1.slerp(rot2, 0.5); assert_eq!(result2.as_degrees(), 67.5);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
as_degrees
Returns the rotation in degrees in the
(-180, 180]range.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
length
Computes the length or norm of the complex number used to represent the rotation. The length is typically expected to be
1.0. Unexpectedly denormalized rotations can be a result of incorrect construction or floating point error caused by successive operations.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
is_finite
Returns
trueif the rotation is neither infinite nor NaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Rot2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
radians
Creates a [
Rot2] from a counterclockwise angle in radians.Note
The input rotation will always be clamped to the range
(-π, π]by design.Example
# use bevy_math::Rot2; # use approx::assert_relative_eq; # use std::f32::consts::{FRAC_PI_2, PI}; let rot1 = Rot2::radians(3.0 * FRAC_PI_2); let rot2 = Rot2::radians(-FRAC_PI_2); #[cfg(feature = "approx")] assert_relative_eq!(rot1, rot2); let rot3 = Rot2::radians(PI); #[cfg(feature = "approx")] assert_relative_eq!(rot1 * rot1, rot3);
Arguments
| Name | Type | Documentation |
|---|---|---|
| radians | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Rot2 | No Documentation 🚧 |
Instant
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| saturating_duration_since | Returns the amount of time elapsed from another instant to this one, or zero duration if that inst... |
| sub | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| add | # Panics This function may panic if the resulting point in time cannot be represented by the unde... |
| sub-1 | No Documentation 🚧 |
| now | Returns an instant corresponding to "now". # Examples ``` use std::time::Instant; let now = Instant::now(); `... |
| elapsed | Returns the amount of time elapsed since this instant. # Panics Previous Rust versions panicked w... |
| duration_since | Returns the amount of time elapsed from another instant to this one, or zero duration if that inst... |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Instant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Instant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Instant | No Documentation 🚧 |
saturating_duration_since
Returns the amount of time elapsed from another instant to this one, or zero duration if that instant is later than this one.
Examples
use std::time::{Duration, Instant}; use std::thread::sleep; let now = Instant::now(); sleep(Duration::new(1, 0)); let new_now = Instant::now(); println!("{:?}", new_now.saturating_duration_since(now)); println!("{:?}", now.saturating_duration_since(new_now)); // 0ns
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Instant | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
add
Panics
This function may panic if the resulting point in time cannot be represented by the underlying data structure. See [
Instant::checked_add] for a version without panic.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Instant | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
now
Returns an instant corresponding to "now".
Examples
use std::time::Instant; let now = Instant::now();
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Instant | No Documentation 🚧 |
elapsed
Returns the amount of time elapsed since this instant.
Panics
Previous Rust versions panicked when the current time was earlier than self. Currently this method returns a Duration of zero in that case. Future versions may reintroduce the panic. See [Monotonicity]. [Monotonicity]: Instant#monotonicity
Examples
use std::thread::sleep; use std::time::{Duration, Instant}; let instant = Instant::now(); let three_secs = Duration::from_secs(3); sleep(three_secs); assert!(instant.elapsed() >= three_secs);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Instant | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
duration_since
Returns the amount of time elapsed from another instant to this one, or zero duration if that instant is later than this one.
Panics
Previous Rust versions panicked when
earlierwas later thanself. Currently this method saturates. Future versions may reintroduce the panic in some circumstances. See [Monotonicity]. [Monotonicity]: Instant#monotonicityExamples
use std::time::{Duration, Instant}; use std::thread::sleep; let now = Instant::now(); sleep(Duration::new(1, 0)); let new_now = Instant::now(); println!("{:?}", new_now.duration_since(now)); println!("{:?}", now.duration_since(new_now)); // 0ns
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
Fixed
Fixed
- timestep:core::time::Duration
- overstep:core::time::Duration
Description
The fixed timestep game clock following virtual time.
A specialization of the [
Time] structure. For method documentation, see [Time<Fixed>#impl-Time<Fixed>].It is automatically inserted as a resource by
TimePluginand updated based onTime<Virtual>. The fixed clock is automatically set as the generic [Time] resource duringFixedUpdateschedule processing.The fixed timestep clock advances in fixed-size increments, which is extremely useful for writing logic (like physics) that should have consistent behavior, regardless of framerate.
The default
timestep()is 64 hertz, or 15625 microseconds. This value was chosen because using 60 hertz has the potential for a pathological interaction with the monitor refresh rate where the game alternates between running two fixed timesteps and zero fixed timesteps per frame (for example when running two fixed timesteps takes longer than a frame). Additionally, the value is a power of two which losslessly converts into [f32] and [f64].To run a system on a fixed timestep, add it to one of the [
FixedMain] schedules, most commonlyFixedUpdate.This schedule is run a number of times between
PreUpdateandUpdateaccording to the accumulatedoverstep()time divided by thetimestep(). This means the schedule may run 0, 1 or more times during a single update (which typically corresponds to a rendered frame).
Time<Fixed>and the generic [Time] resource will report adelta()equal totimestep()and always growelapsed()by onetimestep()per iteration.The fixed timestep clock follows the
Time<Virtual>clock, which means it is affected bypause(),set_relative_speed()andset_max_delta()from virtual time. If the virtual clock is paused, theFixedUpdateschedule will not run. It is guaranteed that theelapsed()time inTime<Fixed>is always between the previouselapsed()and the currentelapsed()value inTime<Virtual>, so the values are compatible.Changing the timestep size while the game is running should not normally be done, as having a regular interval is the point of this schedule, but it may be necessary for effects like "bullet-time" if the normal granularity of the fixed timestep is too big for the slowed down time. In this case,
set_timestep()and be called to set a new value. The new value will be used immediately for the next run of theFixedUpdateschedule, meaning that it will affect thedelta()value for the very nextFixedUpdate, even if it is still during the same frame. Anyoverstep()present in the accumulator will be processed according to the newtimestep()value.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Fixed | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Fixed | No Documentation 🚧 |
Real
Real
- startup:bevy_platform::time::Instant
- first_update:core::option::Option<bevy_platform::time::Instant>
- last_update:core::option::Option<bevy_platform::time::Instant>
Description
Real time clock representing elapsed wall clock time.
A specialization of the [
Time] structure. For method documentation, see [Time<Real>#impl-Time<Real>].It is automatically inserted as a resource by
TimePluginand updated with time instants according toTimeUpdateStrategy.1Note: Using
TimeUpdateStrategy::ManualDurationallows for mocking the wall clock for testing purposes. Besides this use case, it is not recommended to do this, as it will no longer represent "wall clock" time as intended.The
delta()andelapsed()values of this clock should be used for anything which deals specifically with real time (wall clock time). It will not be affected by relative game speed adjustments, pausing or other adjustments.1The clock does not count time from
startup()tofirst_update()into elapsed, but instead will start counting time from the first update call.delta()andelapsed()will report zero on the first update as there is no previous update instant. This means that adelta()of zero must be handled without errors in application logic, as it may theoretically also happen at other times.[
Instant]s forstartup(),first_update()andlast_update()are recorded and accessible.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
-
When using
TimeUpdateStrategy::ManualDuration, [Time<Real>#impl-Time<Real>] is only a mock of wall clock time. ↩ ↩2
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Real | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Real | No Documentation 🚧 |
Stopwatch
Stopwatch
- elapsed:core::time::Duration
- is_paused:bool
Description
A Stopwatch is a struct that tracks elapsed time when started.
Note that in order to advance the stopwatch
tickMUST be called.Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); assert_eq!(stopwatch.elapsed_secs(), 0.0); stopwatch.tick(Duration::from_secs_f32(1.0)); // tick one second assert_eq!(stopwatch.elapsed_secs(), 1.0); stopwatch.pause(); stopwatch.tick(Duration::from_secs_f32(1.0)); // paused stopwatches don't tick assert_eq!(stopwatch.elapsed_secs(), 1.0); stopwatch.reset(); // reset the stopwatch assert!(stopwatch.is_paused()); assert_eq!(stopwatch.elapsed_secs(), 0.0);
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| elapsed_secs | Returns the elapsed time since the last [`reset`](Stopwatch::reset) of the stopwatch, in seconds. # Examples ``` # use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.tick(Duration::from_secs(1)); assert_eq!(stopwatch.elapsed_secs(), 1.0); ``` # See Also [`elapsed`](Stopwatch::elapsed)... |
| new | Create a new unpaused `Stopwatch` with no elapsed time. # Examples ``` # use bevy_time::*; let stopwatch = Stopwatch::new(); assert_eq!(stopwatch.elapsed_secs(), 0.0); assert_eq!(stopwatch.is_paused(), false); ``` |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| elapsed_secs_f64 | Returns the elapsed time since the last [`reset`](Stopwatch::reset) of the stopwatch, in seconds, as f64. # See Also [`elapsed`](Stopwatch::elapsed)... |
| set_elapsed | Sets the elapsed time of the stopwatch. # Examples ``` # use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.set_elapsed(Duration::from_secs_f32(1.0)); assert_eq!(stopwatch.elapsed_secs(), 1.0); ``` |
| elapsed | Returns the elapsed time since the last [`reset`](Stopwatch::reset) of the stopwatch. # Examples ``` # use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.tick(Duration::from_secs(1)); assert_eq!(stopwatch.elapsed(), Duration::from_secs(1)); ``` # See Also [`elapsed_secs`](Stopwatch::elapsed_secs)... |
| clone | No Documentation 🚧 |
| is_paused | Returns `true` if the stopwatch is paused. # Examples ``` # use bevy_time::*; let mut stopwatch = Stopwatch::new(); assert!(!stopwatch.is_paused()); stopwatch.pause(); assert!(stopwatch.is_paused()); stopwatch.unpause(); assert!(!stopwatch.is_paused()); ``` |
| eq | No Documentation 🚧 |
| reset | Resets the stopwatch. The reset doesn't affect the paused state of the stopwatch. # Examples ``` # use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.tick(Duration::from_secs_f32(1.5)); stopwatch.reset(); assert_eq!(stopwatch.elapsed_secs(), 0.0); ``` |
| pause | Pauses the stopwatch. Any call to [`tick`](Stopwatch::tick) while paused will not have any effect on the elapsed time. # Examples ``` # use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.pause(); stopwatch.tick(Duration::from_secs_f32(1.5)); assert!(stopwatch.is_paused()); assert_eq!(stopwatch.elapsed_secs(), 0.0); ``` |
| unpause | Unpauses the stopwatch. Resume the effect of ticking on elapsed time. # Examples ``` # use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.pause(); stopwatch.tick(Duration::from_secs_f32(1.0)); stopwatch.unpause(); stopwatch.tick(Duration::from_secs_f32(1.0)); assert!(!stopwatch.is_paused()); assert_eq!(stopwatch.elapsed_secs(), 1.0); ``` |
elapsed_secs
Returns the elapsed time since the last
resetof the stopwatch, in seconds.Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.tick(Duration::from_secs(1)); assert_eq!(stopwatch.elapsed_secs(), 1.0);See Also
elapsed- if aDurationis desirable instead.elapsed_secs_f64- if anf64is desirable instead.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Stopwatch | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
new
Create a new unpaused
Stopwatchwith no elapsed time.Examples
# use bevy_time::*; let stopwatch = Stopwatch::new(); assert_eq!(stopwatch.elapsed_secs(), 0.0); assert_eq!(stopwatch.is_paused(), false);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Stopwatch | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Stopwatch | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
elapsed_secs_f64
Returns the elapsed time since the last
resetof the stopwatch, in seconds, as f64.See Also
elapsed- if aDurationis desirable instead.elapsed_secs- if anf32is desirable instead.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Stopwatch | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
set_elapsed
Sets the elapsed time of the stopwatch.
Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.set_elapsed(Duration::from_secs_f32(1.0)); assert_eq!(stopwatch.elapsed_secs(), 1.0);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
elapsed
Returns the elapsed time since the last
resetof the stopwatch.Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.tick(Duration::from_secs(1)); assert_eq!(stopwatch.elapsed(), Duration::from_secs(1));See Also
elapsed_secs- if anf32value is desirable instead.elapsed_secs_f64- if anf64is desirable instead.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Stopwatch | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Stopwatch | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Stopwatch | No Documentation 🚧 |
is_paused
Returns
trueif the stopwatch is paused.Examples
# use bevy_time::*; let mut stopwatch = Stopwatch::new(); assert!(!stopwatch.is_paused()); stopwatch.pause(); assert!(stopwatch.is_paused()); stopwatch.unpause(); assert!(!stopwatch.is_paused());
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Stopwatch | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
reset
Resets the stopwatch. The reset doesn't affect the paused state of the stopwatch.
Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.tick(Duration::from_secs_f32(1.5)); stopwatch.reset(); assert_eq!(stopwatch.elapsed_secs(), 0.0);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Stopwatch | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
pause
Pauses the stopwatch. Any call to
tickwhile paused will not have any effect on the elapsed time.Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.pause(); stopwatch.tick(Duration::from_secs_f32(1.5)); assert!(stopwatch.is_paused()); assert_eq!(stopwatch.elapsed_secs(), 0.0);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Stopwatch | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
unpause
Unpauses the stopwatch. Resume the effect of ticking on elapsed time.
Examples
# use bevy_time::*; use std::time::Duration; let mut stopwatch = Stopwatch::new(); stopwatch.pause(); stopwatch.tick(Duration::from_secs_f32(1.0)); stopwatch.unpause(); stopwatch.tick(Duration::from_secs_f32(1.0)); assert!(!stopwatch.is_paused()); assert_eq!(stopwatch.elapsed_secs(), 1.0);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Stopwatch | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
Timer
Timer
- stopwatch:bevy_time::stopwatch::Stopwatch
- duration:core::time::Duration
- mode:bevy_time::timer::TimerMode
- finished:bool
- times_finished_this_tick:u32
Description
Tracks elapsed time. Enters the finished state once
durationis reached.Non repeating timers will stop tracking and stay in the finished state until reset. Repeating timers will only be in the finished state on each tick
durationis reached or exceeded, and can still be reset at any given point.Paused timers will not have elapsed time increased.
Note that in order to advance the timer
tickMUST be called.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates a new timer with a given duration. See also [`Timer::from_seconds`](Timer::from_seconds). |
| set_elapsed | Sets the elapsed time of the timer without any other considerations. See also [`Stopwatch::set`](Stopwatch::set). # ``` # use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.set_elapsed(Duration::from_secs(2)); assert_eq!(timer.elapsed(), Duration::from_secs(2)); // the timer is not finished even if the elapsed time is greater than the duration. assert!(!timer.finished()); ``` |
| set_mode | Sets the mode of the timer. # Examples ``` # use bevy_time::*; let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); timer.set_mode(TimerMode::Once); assert_eq!(timer.mode(), TimerMode::Once); ``` |
| elapsed | Returns the time elapsed on the timer. Guaranteed to be between 0.0 and `duration`. Will only equa... |
| pause | Pauses the Timer. Disables the ticking of the timer. See also [`Stopwatch::pause`](Stopwatch::pause). # Examples ``` # use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.pause(); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.elapsed_secs(), 0.0); ``` |
| duration | Returns the duration of the timer. # Examples ``` # use bevy_time::*; use std::time::Duration; let timer = Timer::new(Duration::from_secs(1), TimerMode::Once); assert_eq!(timer.duration(), Duration::from_secs(1)); ``` |
| reset | Resets the timer. The reset doesn't affect the `paused` state of the timer. See also [`Stopwatch::reset`](Stopwatch::reset)... |
| eq | No Documentation 🚧 |
| from_seconds | Creates a new timer with a given duration in seconds. # Example ``` # use bevy_time::*; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); ``` |
| clone | No Documentation 🚧 |
| elapsed_secs | Returns the time elapsed on the timer as an `f32`. See also [`Timer::elapsed`](Timer::elapsed). |
| paused | Returns `true` if the timer is paused. See also [`Stopwatch::is_paused`](Stopwatch::is_paused). # Examples ``` # use bevy_time::*; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); assert!(!timer.paused()); timer.pause(); assert!(timer.paused()); timer.unpause(); assert!(!timer.paused()); ``` |
| mode | Returns the mode of the timer. # Examples ``` # use bevy_time::*; let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); assert_eq!(timer.mode(), TimerMode::Repeating); ``` |
| fraction_remaining | Returns the fraction of the timer remaining time (goes from 1.0 to 0.0). # Examples ``` # use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(2.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.fraction_remaining(), 0.75); ``` |
| remaining | Returns the remaining time using Duration # Examples ``` # use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(2.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.remaining(), Duration::from_secs_f32(1.5)); ``` |
| elapsed_secs_f64 | Returns the time elapsed on the timer as an `f64`. See also [`Timer::elapsed`](Timer::elapsed). |
| remaining_secs | Returns the remaining time in seconds # Examples ``` # use bevy_time::*; use std::cmp::Ordering; use std::time::Duration; let mut timer = Timer::from_seconds(2.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); let result = timer.remaining_secs().total_cmp(&1.5); assert_eq!(Ordering::Equal, result); ``` |
| times_finished_this_tick | Returns the number of times a repeating timer finished during the last [`tick`](Timer |
| set_duration | Sets the duration of the timer. # Examples ``` # use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.5, TimerMode::Once); timer.set_duration(Duration::from_secs(1)); assert_eq!(timer.duration(), Duration::from_secs(1)); ``` |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| unpause | Unpauses the Timer. Resumes the ticking of the timer. See also [`Stopwatch::unpause()`](Stopwatch::unpause). # Examples ``` # use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.pause(); timer.tick(Duration::from_secs_f32(0.5)); timer.unpause(); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.elapsed_secs(), 0.5); ``` |
| fraction | Returns the fraction of the timer elapsed time (goes from 0.0 to 1.0). # Examples ``` # use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(2.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.fraction(), 0.25); ``` |
| just_finished | Returns `true` only on the tick the timer reached its duration. # Examples ``` # use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(1.5)); assert!(timer.just_finished()); timer.tick(Duration::from_secs_f32(0.5)); assert!(!timer.just_finished()); ``` |
| finished | Returns `true` if the timer has reached its duration. For repeating timers, this method behaves id... |
new
Creates a new timer with a given duration. See also
Timer::from_seconds.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Timer | No Documentation 🚧 |
set_elapsed
Sets the elapsed time of the timer without any other considerations. See also
Stopwatch::set.
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.set_elapsed(Duration::from_secs(2)); assert_eq!(timer.elapsed(), Duration::from_secs(2)); // the timer is not finished even if the elapsed time is greater than the duration. assert!(!timer.finished());
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
set_mode
Sets the mode of the timer.
Examples
# use bevy_time::*; let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); timer.set_mode(TimerMode::Once); assert_eq!(timer.mode(), TimerMode::Once);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
elapsed
Returns the time elapsed on the timer. Guaranteed to be between 0.0 and
duration. Will only equaldurationwhen the timer is finished and non repeating. See alsoStopwatch::elapsed.Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.elapsed(), Duration::from_secs_f32(0.5));
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
pause
Pauses the Timer. Disables the ticking of the timer. See also
Stopwatch::pause.Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.pause(); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.elapsed_secs(), 0.0);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
duration
Returns the duration of the timer.
Examples
# use bevy_time::*; use std::time::Duration; let timer = Timer::new(Duration::from_secs(1), TimerMode::Once); assert_eq!(timer.duration(), Duration::from_secs(1));
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
reset
Resets the timer. The reset doesn't affect the
pausedstate of the timer. See alsoStopwatch::reset. Examples# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(1.5)); timer.reset(); assert!(!timer.finished()); assert!(!timer.just_finished()); assert_eq!(timer.elapsed_secs(), 0.0);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_seconds
Creates a new timer with a given duration in seconds.
Example
# use bevy_time::*; let mut timer = Timer::from_seconds(1.0, TimerMode::Once);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Timer | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Timer | No Documentation 🚧 |
elapsed_secs
Returns the time elapsed on the timer as an
f32. See alsoTimer::elapsed.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
paused
Returns
trueif the timer is paused. See alsoStopwatch::is_paused.Examples
# use bevy_time::*; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); assert!(!timer.paused()); timer.pause(); assert!(timer.paused()); timer.unpause(); assert!(!timer.paused());
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
mode
Returns the mode of the timer.
Examples
# use bevy_time::*; let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); assert_eq!(timer.mode(), TimerMode::Repeating);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | TimerMode | No Documentation 🚧 |
fraction_remaining
Returns the fraction of the timer remaining time (goes from 1.0 to 0.0).
Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(2.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.fraction_remaining(), 0.75);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
remaining
Returns the remaining time using Duration
Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(2.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.remaining(), Duration::from_secs_f32(1.5));
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
elapsed_secs_f64
Returns the time elapsed on the timer as an
f64. See alsoTimer::elapsed.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
remaining_secs
Returns the remaining time in seconds
Examples
# use bevy_time::*; use std::cmp::Ordering; use std::time::Duration; let mut timer = Timer::from_seconds(2.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); let result = timer.remaining_secs().total_cmp(&1.5); assert_eq!(Ordering::Equal, result);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
times_finished_this_tick
Returns the number of times a repeating timer finished during the last
tickcall. For non repeating-timers, this method will only ever return 0 or 1.Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); timer.tick(Duration::from_secs_f32(6.0)); assert_eq!(timer.times_finished_this_tick(), 6); timer.tick(Duration::from_secs_f32(2.0)); assert_eq!(timer.times_finished_this_tick(), 2); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.times_finished_this_tick(), 0);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
set_duration
Sets the duration of the timer.
Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.5, TimerMode::Once); timer.set_duration(Duration::from_secs(1)); assert_eq!(timer.duration(), Duration::from_secs(1));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
unpause
Unpauses the Timer. Resumes the ticking of the timer. See also
Stopwatch::unpause().Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.pause(); timer.tick(Duration::from_secs_f32(0.5)); timer.unpause(); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.elapsed_secs(), 0.5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
fraction
Returns the fraction of the timer elapsed time (goes from 0.0 to 1.0).
Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(2.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(0.5)); assert_eq!(timer.fraction(), 0.25);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
just_finished
Returns
trueonly on the tick the timer reached its duration.Examples
# use bevy_time::*; use std::time::Duration; let mut timer = Timer::from_seconds(1.0, TimerMode::Once); timer.tick(Duration::from_secs_f32(1.5)); assert!(timer.just_finished()); timer.tick(Duration::from_secs_f32(0.5)); assert!(!timer.just_finished());
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
finished
Returns
trueif the timer has reached its duration. For repeating timers, this method behaves identically to [Timer::just_finished].Examples
# use bevy_time::*; use std::time::Duration; let mut timer_once = Timer::from_seconds(1.0, TimerMode::Once); timer_once.tick(Duration::from_secs_f32(1.5)); assert!(timer_once.finished()); timer_once.tick(Duration::from_secs_f32(0.5)); assert!(timer_once.finished()); let mut timer_repeating = Timer::from_seconds(1.0, TimerMode::Repeating); timer_repeating.tick(Duration::from_secs_f32(1.1)); assert!(timer_repeating.finished()); timer_repeating.tick(Duration::from_secs_f32(0.8)); assert!(!timer_repeating.finished()); timer_repeating.tick(Duration::from_secs_f32(0.6)); assert!(timer_repeating.finished());
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Timer | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
TimerMode
Once
Repeating
Description
Specifies [
Timer] behavior.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | TimerMode | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | TimerMode | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | TimerMode | No Documentation 🚧 |
Virtual
Virtual
- max_delta:core::time::Duration
- paused:bool
- relative_speed:f64
- effective_speed:f64
Description
The virtual game clock representing game time.
A specialization of the [
Time] structure. For method documentation, see [Time<Virtual>#impl-Time<Virtual>].Normally used as
Time<Virtual>. It is automatically inserted as a resource byTimePluginand updated based onTime<Real>. The virtual clock is automatically set as the default generic [Time] resource for the update.The virtual clock differs from real time clock in that it can be paused, sped up and slowed down. It also limits how much it can advance in a single update in order to prevent unexpected behavior in cases where updates do not happen at regular intervals (e.g. coming back after the program was suspended a long time).
The virtual clock can be paused by calling
pause()and unpaused by callingunpause(). When the game clock is pauseddelta()will be zero on each update, andelapsed()will not grow.effective_speed()will return0.0. Callingpause()will not affect value thedelta()value for the update currently being processed.The speed of the virtual clock can be changed by calling
set_relative_speed(). A value of2.0means that virtual clock should advance twice as fast as real time, meaning thatdelta()values will be double of whatTime<Real>::delta()reports andelapsed()will go twice as fast asTime<Real>::elapsed(). Callingset_relative_speed()will not affect thedelta()value for the update currently being processed.The maximum amount of delta time that can be added by a single update can be set by
set_max_delta(). This value serves a dual purpose in the virtual clock.If the game temporarily freezes due to any reason, such as disk access, a blocking system call, or operating system level suspend, reporting the full elapsed delta time is likely to cause bugs in game logic. Usually if a laptop is suspended for an hour, it doesn't make sense to try to simulate the game logic for the elapsed hour when resuming. Instead it is better to lose the extra time and pretend a shorter duration of time passed. Setting
max_delta()to a relatively short time means that the impact on game logic will be minimal.If the game lags for some reason, meaning that it will take a longer time to compute a frame than the real time that passes during the computation, then we would fall behind in processing virtual time. If this situation persists, and computing a frame takes longer depending on how much virtual time has passed, the game would enter a "death spiral" where computing each frame takes longer and longer and the game will appear to freeze. By limiting the maximum time that can be added at once, we also limit the amount of virtual time the game needs to compute for each frame. This means that the game will run slow, and it will run slower than real time, but it will not freeze and it will recover as soon as computation becomes fast again.
You should set
max_delta()to a value that is approximately the minimum FPS your game should have even if heavily lagged for a moment. The actual FPS when lagged will be somewhat lower than this, depending on how much more time it takes to compute a frame compared to real time. You should also consider how stable your FPS is, as the limit will also dictate how big of an FPS drop you can accept without losing time and falling behind real time.
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| clone | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Virtual | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Virtual | No Documentation 🚧 |
GlobalTransform
GlobalTransform
- glam::Affine3A
Description
[
GlobalTransform] is an affine transformation from entity-local coordinates to worldspace coordinates.You cannot directly mutate [
GlobalTransform]; instead, you change an entity's transform by manipulating its [Transform], which indirectly causes Bevy to update its [GlobalTransform].
- To get the global transform of an entity, you should get its [
GlobalTransform].- For transform hierarchies to work correctly, you must have both a [
Transform] and a [GlobalTransform]. [GlobalTransform] is automatically inserted whenever [Transform] is inserted.[
Transform] and [GlobalTransform][
Transform] transforms an entity relative to its parent's reference frame, or relative to world space coordinates, if it doesn't have aChildOfcomponent.[
GlobalTransform] is managed by Bevy; it is computed by successively applying the [Transform] of each ancestor entity which has a Transform. This is done automatically by Bevy-internal systems in the system setTransformPropagate.This system runs during
PostUpdate. If you update the [Transform] of an entity in this schedule or after, you will notice a 1 frame lag before the [GlobalTransform] is updated.Examples
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| back | Return the local back vector (Z). |
| compute_matrix | Returns the 3d affine transformation matrix as a [`Mat4`]. |
| mul-1 | No Documentation 🚧 |
| forward | Return the local forward vector (-Z). |
| reparented_to | Returns the [`Transform`] `self` would have if it was a child of an entity with the `parent` [`GlobalTransform`... |
| clone | No Documentation 🚧 |
| transform_point | Transforms the given point from local space to global space, applying shear, scale, rotation and tr... |
| mul | No Documentation 🚧 |
| radius_vec3a | Get an upper bound of the radius from the given `extents`. |
| from_isometry | No Documentation 🚧 |
| down | Return the local down vector (-Y). |
| mul-2 | No Documentation 🚧 |
| rotation | Get the rotation as a [`Quat`]. The transform is expected to be non-degenerate and without shearing, or the output will be invalid. # Warning This is calculated using `to_scale_rotation_translation`, meaning that you should probably use it directly if you also need translation or scale. |
| from_xyz | No Documentation 🚧 |
| mul_transform | Multiplies `self` with `transform` component by component, returning the resulting [`GlobalTransform`]... |
| compute_transform | Returns the transformation as a [`Transform`]. The transform is expected to be non-degenerate and without shearing, or the output will be invalid. |
| from_translation | No Documentation 🚧 |
| translation_vec3a | Get the translation as a [`Vec3A`]. |
| eq | No Documentation 🚧 |
| up | Return the local up vector (Y). |
| right | Return the local right vector (X). |
| left | Return the local left vector (-X). |
| scale | Get the scale as a [`Vec3`]. The transform is expected to be non-degenerate and without shearing, or the output will be invalid. Some of the computations overlap with `to_scale_rotation_translation`, which means you should use it instead if you also need rotation. |
| from_scale | No Documentation 🚧 |
| from_rotation | No Documentation 🚧 |
| translation | Get the translation as a [`Vec3`]. |
| affine | Returns the 3d affine transformation matrix as an [`Affine3A`]. |
| to_isometry | Returns the isometric part of the transformation as an [isometry]. Any scaling done by the transformation will be ignored. The transform is expected to be non-degenerate and without shearing, or the output will be invalid. [isometry]... |
back
Return the local back vector (Z).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
compute_matrix
Returns the 3d affine transformation matrix as a [
Mat4].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| arg0 | GlobalTransform | No Documentation 🚧 |
| arg1 | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GlobalTransform | No Documentation 🚧 |
forward
Return the local forward vector (-Z).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
reparented_to
Returns the [
Transform]selfwould have if it was a child of an entity with theparent[GlobalTransform]. This is useful if you want to "reparent" anEntity. Say you have an entitye1that you want to turn into a child ofe2, but you wante1to keep the same global transform, even after re-parenting. You would use:# use bevy_transform::prelude::{GlobalTransform, Transform}; # use bevy_ecs::prelude::{Entity, Query, Component, Commands}; #[derive(Component)] struct ToReparent { new_parent: Entity, } fn reparent_system( mut commands: Commands, mut targets: Query<(&mut Transform, Entity, &GlobalTransform, &ToReparent)>, transforms: Query<&GlobalTransform>, ) { for (mut transform, entity, initial, to_reparent) in targets.iter_mut() { if let Ok(parent_transform) = transforms.get(to_reparent.new_parent) { *transform = initial.reparented_to(parent_transform); commands.entity(entity) .remove::<ToReparent>() .set_parent(to_reparent.new_parent); } } }The transform is expected to be non-degenerate and without shearing, or the output will be invalid.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
| parent | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GlobalTransform | No Documentation 🚧 |
transform_point
Transforms the given point from local space to global space, applying shear, scale, rotation and translation. It can be used like this:
# use bevy_transform::prelude::{GlobalTransform}; # use bevy_math::prelude::Vec3; let global_transform = GlobalTransform::from_xyz(1., 2., 3.); let local_point = Vec3::new(1., 2., 3.); let global_point = global_transform.transform_point(local_point); assert_eq!(global_point, Vec3::new(2., 4., 6.));# use bevy_transform::prelude::{GlobalTransform}; # use bevy_math::Vec3; let global_point = Vec3::new(2., 4., 6.); let global_transform = GlobalTransform::from_xyz(1., 2., 3.); let local_point = global_transform.affine().inverse().transform_point3(global_point); assert_eq!(local_point, Vec3::new(1., 2., 3.))To apply shear, scale, and rotation without applying translation, different functions are available:
# use bevy_transform::prelude::{GlobalTransform}; # use bevy_math::prelude::Vec3; let global_transform = GlobalTransform::from_xyz(1., 2., 3.); let local_direction = Vec3::new(1., 2., 3.); let global_direction = global_transform.affine().transform_vector3(local_direction); assert_eq!(global_direction, Vec3::new(1., 2., 3.)); let roundtripped_local_direction = global_transform.affine().inverse().transform_vector3(global_direction); assert_eq!(roundtripped_local_direction, local_direction);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
| point | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
| value | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
radius_vec3a
Get an upper bound of the radius from the given
extents.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
| extents | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_isometry
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| iso | Isometry3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GlobalTransform | No Documentation 🚧 |
down
Return the local down vector (-Y).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| arg0 | GlobalTransform | No Documentation 🚧 |
| arg1 | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GlobalTransform | No Documentation 🚧 |
rotation
Get the rotation as a [
Quat]. The transform is expected to be non-degenerate and without shearing, or the output will be invalid.Warning
This is calculated using
to_scale_rotation_translation, meaning that you should probably use it directly if you also need translation or scale.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
from_xyz
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GlobalTransform | No Documentation 🚧 |
mul_transform
Multiplies
selfwithtransformcomponent by component, returning the resulting [GlobalTransform]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
| transform | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GlobalTransform | No Documentation 🚧 |
compute_transform
Returns the transformation as a [
Transform]. The transform is expected to be non-degenerate and without shearing, or the output will be invalid.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
from_translation
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| translation | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GlobalTransform | No Documentation 🚧 |
translation_vec3a
Get the translation as a [
Vec3A].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
| other | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
up
Return the local up vector (Y).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
right
Return the local right vector (X).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
left
Return the local left vector (-X).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
scale
Get the scale as a [
Vec3]. The transform is expected to be non-degenerate and without shearing, or the output will be invalid. Some of the computations overlap withto_scale_rotation_translation, which means you should use it instead if you also need rotation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
from_scale
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GlobalTransform | No Documentation 🚧 |
from_rotation
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| rotation | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GlobalTransform | No Documentation 🚧 |
translation
Get the translation as a [
Vec3].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
affine
Returns the 3d affine transformation matrix as an [
Affine3A].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
to_isometry
Returns the isometric part of the transformation as an [isometry]. Any scaling done by the transformation will be ignored. The transform is expected to be non-degenerate and without shearing, or the output will be invalid. [isometry]: Isometry3d
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
Transform
Transform
- translation:glam::Vec3
- rotation:glam::Quat
- scale:glam::Vec3
Description
Describe the position of an entity. If the entity has a parent, the position is relative to its parent position.
- To place or move an entity, you should set its [
Transform].- To get the global transform of an entity, you should get its [
GlobalTransform].- To be displayed, an entity must have both a [
Transform] and a [GlobalTransform]. [GlobalTransform] is automatically inserted whenever [Transform] is inserted.[
Transform] and [GlobalTransform][
Transform] is the position of an entity relative to its parent position, or the reference frame if it doesn't have aChildOfcomponent.[
GlobalTransform] is the position of an entity relative to the reference frame.[
GlobalTransform] is updated from [Transform] by systems in the system setTransformPropagate.This system runs during
PostUpdate. If you update the [Transform] of an entity during this set or after, you will notice a 1 frame lag before the [GlobalTransform] is updated.Examples
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| rotate_local | Rotates this [`Transform`] by the given `rotation`. The `rotation` is relative to this [`Transform... |
| rotate_local_z | Rotates this [`Transform`] around its local `Z` axis by `angle` (in radians). |
| local_x | Get the unit vector in the local `X` direction. |
| rotate_local_x | Rotates this [`Transform`] around its local `X` axis by `angle` (in radians). |
| compute_matrix | Returns the 3d affine transformation matrix from this transforms translation, rotation, and scale. |
| with_scale | Returns this [`Transform`] with a new scale. |
| compute_affine | Returns the 3d affine transformation matrix from this transforms translation, rotation, and scale. |
| left | Equivalent to [`-local_x()`][Transform::local_x()] |
| from_scale | Creates a new [`Transform`], with `scale`. Translation will be 0 and rotation 0 on all axes. |
| rotate_x | Rotates this [`Transform`] around the `X` axis by `angle` (in radians). If this [`Transform`] has ... |
| rotate_z | Rotates this [`Transform`] around the `Z` axis by `angle` (in radians). If this [`Transform`] has ... |
| rotate_around | Rotates this [`Transform`] around a `point` in space. If this [`Transform`] has a parent, the `point`... |
| from_isometry | Creates a new [`Transform`] that is equivalent to the given [isometry]. [isometry]: Isometry3d |
| from_xyz | Creates a new [`Transform`] at the position `(x, y, z)`. In 2d, the `z` component is used for z-ordering elements: higher `z`-value will be in front of lower `z`-value. |
| to_isometry | Get the [isometry] defined by this transform's rotation and translation, ignoring scale. [isometry... |
| forward | Equivalent to [`-local_z()`][Transform::local_z] |
| rotate_local_y | Rotates this [`Transform`] around its local `Y` axis by `angle` (in radians). |
| eq | No Documentation 🚧 |
| with_rotation | Returns this [`Transform`] with a new rotation. |
| mul-2 | No Documentation 🚧 |
| with_translation | Returns this [`Transform`] with a new translation. |
| from_rotation | Creates a new [`Transform`], with `rotation`. Translation will be 0 and scale 1 on all axes. |
| is_finite | Returns `true` if, and only if, translation, rotation and scale all are finite. If any of them con... |
| rotate_local_axis | Rotates this [`Transform`] around its local `axis` by `angle` (in radians). # Warning If you pass in an `axis` based on the current rotation (e.g. obtained via [`Transform::local_x`]... |
| down | Equivalent to [`-local_y()`][Transform::local_y] |
| translate_around | Translates this [`Transform`] around a `point` in space. If this [`Transform`] has a parent, the `point`... |
| local_z | Get the unit vector in the local `Z` direction. |
| from_translation | Creates a new [`Transform`], with `translation`. Rotation will be 0 and scale 1 on all axes. |
| up | Equivalent to [`local_y()`][Transform::local_y] |
| local_y | Get the unit vector in the local `Y` direction. |
| from_matrix | Extracts the translation, rotation, and scale from `matrix`. It must be a 3d affine transformation... |
| rotate_axis | Rotates this [`Transform`] around the given `axis` by `angle` (in radians). If this [`Transform`] ... |
| transform_point | Transforms the given `point`, applying scale, rotation and translation. If this [`Transform`] has an ancestor entity with a [`Transform`]... |
| rotate | Rotates this [`Transform`] by the given rotation. If this [`Transform`] has a parent, the `rotation`... |
| mul-1 | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| rotate_y | Rotates this [`Transform`] around the `Y` axis by `angle` (in radians). If this [`Transform`] has ... |
| right | Equivalent to [`local_x()`][Transform::local_x()] |
| mul | No Documentation 🚧 |
| back | Equivalent to [`local_z()`][Transform::local_z] |
| mul_transform | Multiplies `self` with `transform` component by component, returning the resulting [`Transform`] |
rotate_local
Rotates this [
Transform] by the givenrotation. Therotationis relative to this [Transform]'s current rotation.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
rotate_local_z
Rotates this [
Transform] around its localZaxis byangle(in radians).
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
local_x
Get the unit vector in the local
Xdirection.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
rotate_local_x
Rotates this [
Transform] around its localXaxis byangle(in radians).
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
compute_matrix
Returns the 3d affine transformation matrix from this transforms translation, rotation, and scale.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
with_scale
Returns this [
Transform] with a new scale.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
compute_affine
Returns the 3d affine transformation matrix from this transforms translation, rotation, and scale.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
left
Equivalent to [
-local_x()][Transform::local_x()]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
from_scale
Creates a new [
Transform], withscale. Translation will be 0 and rotation 0 on all axes.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
rotate_x
Rotates this [
Transform] around theXaxis byangle(in radians). If this [Transform] has a parent, the axis is relative to the rotation of the parent.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
rotate_z
Rotates this [
Transform] around theZaxis byangle(in radians). If this [Transform] has a parent, the axis is relative to the rotation of the parent.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
rotate_around
Rotates this [
Transform] around apointin space. If this [Transform] has a parent, thepointis relative to the [Transform] of the parent.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
| point | Vec3 | No Documentation 🚧 |
| rotation | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
from_isometry
Creates a new [
Transform] that is equivalent to the given [isometry]. [isometry]: Isometry3d
Arguments
| Name | Type | Documentation |
|---|---|---|
| iso | Isometry3d | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
from_xyz
Creates a new [
Transform] at the position(x, y, z). In 2d, thezcomponent is used for z-ordering elements: higherz-value will be in front of lowerz-value.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
to_isometry
Get the [isometry] defined by this transform's rotation and translation, ignoring scale. [isometry]: Isometry3d
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Isometry3d | No Documentation 🚧 |
forward
Equivalent to [
-local_z()][Transform::local_z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
rotate_local_y
Rotates this [
Transform] around its localYaxis byangle(in radians).
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
with_rotation
Returns this [
Transform] with a new rotation.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
with_translation
Returns this [
Transform] with a new translation.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
from_rotation
Creates a new [
Transform], withrotation. Translation will be 0 and scale 1 on all axes.
Arguments
| Name | Type | Documentation |
|---|---|---|
| rotation | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, translation, rotation and scale all are finite. If any of them contains aNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
rotate_local_axis
Rotates this [
Transform] around its localaxisbyangle(in radians).Warning
If you pass in an
axisbased on the current rotation (e.g. obtained via [Transform::local_x]), floating point errors can accumulate exponentially when applying rotations repeatedly this way. This will result in a denormalized rotation. In this case, it is recommended to normalize the [Transform::rotation] after each call to this method.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
| axis | Dir3 | No Documentation 🚧 |
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
down
Equivalent to [
-local_y()][Transform::local_y]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
translate_around
Translates this [
Transform] around apointin space. If this [Transform] has a parent, thepointis relative to the [Transform] of the parent.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
| point | Vec3 | No Documentation 🚧 |
| rotation | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
local_z
Get the unit vector in the local
Zdirection.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
from_translation
Creates a new [
Transform], withtranslation. Rotation will be 0 and scale 1 on all axes.
Arguments
| Name | Type | Documentation |
|---|---|---|
| translation | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
up
Equivalent to [
local_y()][Transform::local_y]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
local_y
Get the unit vector in the local
Ydirection.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
from_matrix
Extracts the translation, rotation, and scale from
matrix. It must be a 3d affine transformation matrix.
Arguments
| Name | Type | Documentation |
|---|---|---|
| world_from_local | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
rotate_axis
Rotates this [
Transform] around the givenaxisbyangle(in radians). If this [Transform] has a parent, theaxisis relative to the rotation of the parent.Warning
If you pass in an
axisbased on the current rotation (e.g. obtained via [Transform::local_x]), floating point errors can accumulate exponentially when applying rotations repeatedly this way. This will result in a denormalized rotation. In this case, it is recommended to normalize the [Transform::rotation] after each call to this method.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
| axis | Dir3 | No Documentation 🚧 |
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
transform_point
Transforms the given
point, applying scale, rotation and translation. If this [Transform] has an ancestor entity with a [Transform] component, [Transform::transform_point] will transform a point in local space into its parent transform's space. If this [Transform] does not have a parent, [Transform::transform_point] will transform a point in local space into worldspace coordinates. If you always want to transform a point in local space to worldspace, or if you need the inverse transformations, see [GlobalTransform::transform_point()].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
rotate
Rotates this [
Transform] by the given rotation. If this [Transform] has a parent, therotationis relative to the rotation of the parent.Examples
- [
3d_rotation] [3d_rotation]: https://github.com/bevyengine/bevy/blob/latest/examples/transforms/3d_rotation.rs
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
| arg1 | GlobalTransform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | GlobalTransform | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
rotate_y
Rotates this [
Transform] around theYaxis byangle(in radians). If this [Transform] has a parent, the axis is relative to the rotation of the parent.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
right
Equivalent to [
local_x()][Transform::local_x()]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
back
Equivalent to [
local_z()][Transform::local_z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Transform | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Dir3 | No Documentation 🚧 |
mul_transform
Multiplies
selfwithtransformcomponent by component, returning the resulting [Transform]
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Transform | No Documentation 🚧 |
TransformTreeChanged
TransformTreeChanged
Description
An optimization for transform propagation. This ZST marker component uses change detection to mark all entities of the hierarchy as "dirty" if any of their descendants have a changed
Transform. If this component is not markedis_changed(), propagation will halt.
Associated Functions
For function details and documentation, click on the function link.
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | TransformTreeChanged | No Documentation 🚧 |
| other | TransformTreeChanged | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | TransformTreeChanged | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | TransformTreeChanged | No Documentation 🚧 |
TypeId
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| assert_receiver_is_total_eq | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | TypeId | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | TypeId | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | TypeId | No Documentation 🚧 |
SocketAddr
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| is_ipv6 | Returns [`true`] if the [IP address] in this `SocketAddr` is an [`IPv6` address], and [`false`] ot... |
| eq | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| is_ipv4 | Returns [`true`] if the [IP address] in this `SocketAddr` is an [`IPv4` address], and [`false`] ot... |
| port | Returns the port number associated with this socket address. # Examples ``` use std::net::{IpAddr, Ipv4Addr, SocketAddr}; let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080); assert_eq!(socket.port(), 8080); ``` |
| set_port | Changes the port number associated with this socket address. # Examples ``` use std::net::{IpAddr, Ipv4Addr, SocketAddr}; let mut socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080); socket.set_port(1025); assert_eq!(socket.port(), 1025); `... |
| clone | No Documentation 🚧 |
is_ipv6
Returns [
true] if the [IP address] in thisSocketAddris an [IPv6address], and [false] otherwise. [IP address]: IpAddr [IPv6address]: IpAddr::V6Examples
use std::net::{IpAddr, Ipv6Addr, SocketAddr}; let socket = SocketAddr::new(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 65535, 0, 1)), 8080); assert_eq!(socket.is_ipv4(), false); assert_eq!(socket.is_ipv6(), true);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | SocketAddr | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | SocketAddr | No Documentation 🚧 |
| other | SocketAddr | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | SocketAddr | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
is_ipv4
Returns [
true] if the [IP address] in thisSocketAddris an [IPv4address], and [false] otherwise. [IP address]: IpAddr [IPv4address]: IpAddr::V4Examples
use std::net::{IpAddr, Ipv4Addr, SocketAddr}; let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080); assert_eq!(socket.is_ipv4(), true); assert_eq!(socket.is_ipv6(), false);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | SocketAddr | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
port
Returns the port number associated with this socket address.
Examples
use std::net::{IpAddr, Ipv4Addr, SocketAddr}; let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080); assert_eq!(socket.port(), 8080);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | SocketAddr | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
set_port
Changes the port number associated with this socket address.
Examples
use std::net::{IpAddr, Ipv4Addr, SocketAddr}; let mut socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080); socket.set_port(1025); assert_eq!(socket.port(), 1025);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | SocketAddr | No Documentation 🚧 |
| new_port | u16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | SocketAddr | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | SocketAddr | No Documentation 🚧 |
RangeFull
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| eq | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RangeFull | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | RangeFull | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | RangeFull | No Documentation 🚧 |
AtomicBool
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
| new | Creates a new `AtomicBool`. # Examples ``` use std::sync::atomic::AtomicBool; let atomic_true = AtomicBool::new(true); let atomic_false = AtomicBool::new(false); `... |
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
selfby value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicBool; let some_bool = AtomicBool::new(true); assert_eq!(some_bool.into_inner(), true);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AtomicBool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Creates a new
AtomicBool.Examples
use std::sync::atomic::AtomicBool; let atomic_true = AtomicBool::new(true); let atomic_false = AtomicBool::new(false);
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AtomicBool | No Documentation 🚧 |
AtomicI16
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
| new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicI16; let atomic_forty_two = AtomicI16::new(42); `... |
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
selfby value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicI16; let some_var = AtomicI16::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AtomicI16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicI16; let atomic_forty_two = AtomicI16::new(42);
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AtomicI16 | No Documentation 🚧 |
AtomicI32
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicI32; let atomic_forty_two = AtomicI32::new(42); `... |
| into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicI32; let atomic_forty_two = AtomicI32::new(42);
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AtomicI32 | No Documentation 🚧 |
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
selfby value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicI32; let some_var = AtomicI32::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AtomicI32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
AtomicI64
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicI64; let atomic_forty_two = AtomicI64::new(42); `... |
| into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicI64; let atomic_forty_two = AtomicI64::new(42);
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AtomicI64 | No Documentation 🚧 |
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
selfby value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicI64; let some_var = AtomicI64::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AtomicI64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
AtomicI8
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
| new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicI8; let atomic_forty_two = AtomicI8::new(42); `... |
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
selfby value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicI8; let some_var = AtomicI8::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AtomicI8 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicI8; let atomic_forty_two = AtomicI8::new(42);
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i8 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AtomicI8 | No Documentation 🚧 |
AtomicIsize
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
| new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicIsize; let atomic_forty_two = AtomicIsize::new(42); `... |
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
selfby value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicIsize; let some_var = AtomicIsize::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AtomicIsize | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | isize | No Documentation 🚧 |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicIsize; let atomic_forty_two = AtomicIsize::new(42);
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | isize | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AtomicIsize | No Documentation 🚧 |
AtomicU16
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicU16; let atomic_forty_two = AtomicU16::new(42); `... |
| into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicU16; let atomic_forty_two = AtomicU16::new(42);
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AtomicU16 | No Documentation 🚧 |
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
selfby value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicU16; let some_var = AtomicU16::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AtomicU16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
AtomicU32
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
| new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicU32; let atomic_forty_two = AtomicU32::new(42); `... |
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
selfby value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicU32; let some_var = AtomicU32::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AtomicU32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicU32; let atomic_forty_two = AtomicU32::new(42);
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AtomicU32 | No Documentation 🚧 |
AtomicU64
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicU64; let atomic_forty_two = AtomicU64::new(42); `... |
| into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicU64; let atomic_forty_two = AtomicU64::new(42);
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AtomicU64 | No Documentation 🚧 |
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
selfby value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicU64; let some_var = AtomicU64::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AtomicU64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
AtomicU8
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicU8; let atomic_forty_two = AtomicU8::new(42); `... |
| into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicU8; let atomic_forty_two = AtomicU8::new(42);
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u8 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AtomicU8 | No Documentation 🚧 |
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
selfby value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicU8; let some_var = AtomicU8::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AtomicU8 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
AtomicUsize
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates a new atomic integer. # Examples ``` use std::sync::atomic::AtomicUsize; let atomic_forty_two = AtomicUsize::new(42); `... |
| into_inner | Consumes the atomic and returns the contained value. This is safe because passing `self` by value ... |
new
Creates a new atomic integer.
Examples
use std::sync::atomic::AtomicUsize; let atomic_forty_two = AtomicUsize::new(42);
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | usize | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | AtomicUsize | No Documentation 🚧 |
into_inner
Consumes the atomic and returns the contained value. This is safe because passing
selfby value guarantees that no other threads are concurrently accessing the atomic data.Examples
use std::sync::atomic::AtomicUsize; let some_var = AtomicUsize::new(5); assert_eq!(some_var.into_inner(), 5);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | AtomicUsize | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | usize | No Documentation 🚧 |
Duration
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| div_duration_f32 | Divides `Duration` by `Duration` and returns `f32`. # Examples ``` use std::time::Duration; let dur1 = Duration::new(2, 700_000_000); let dur2 = Duration::new(5, 400_000_000); assert_eq!(dur1.div_duration_f32(dur2), 0.5); ``` |
| as_nanos | Returns the total number of nanoseconds contained by this `Duration`. # Examples ``` use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_nanos(), 5_730_023_852); ``` |
| mul_f64 | Multiplies `Duration` by `f64`. # Panics This method will panic if result is negative, overflows `Duration`... |
| add | No Documentation 🚧 |
| saturating_mul | Saturating `Duration` multiplication. Computes `self * other`, returning [`Duration::MAX`] if overflow occurred. # Examples ``` #![feature(duration_constants)] use std::time::Duration; assert_eq!(Duration::new(0, 500_000_001).saturating_mul(2), Duration::new(1, 2)); assert_eq!(Duration::new(u64::MAX - 1, 0).saturating_mul(2), Duration::MAX); ``` |
| clone | No Documentation 🚧 |
| div | No Documentation 🚧 |
| saturating_add | Saturating `Duration` addition. Computes `self + other`, returning [`Duration::MAX`] if overflow occurred. # Examples ``` #![feature(duration_constants)]... |
| new | Creates a new `Duration` from the specified number of whole seconds and additional nanoseconds. I... |
| mul_f32 | Multiplies `Duration` by `f32`. # Panics This method will panic if result is negative, overflows `Duration`... |
| from_secs_f64 | Creates a new `Duration` from the specified number of seconds represented as `f64`. # Panics Thi... |
| from_nanos | Creates a new `Duration` from the specified number of nanoseconds. Note: Using this on the return ... |
| abs_diff | Computes the absolute difference between `self` and `other`. # Examples ``` use std::time::Duration; assert_eq!(Duration::new(100, 0).abs_diff(Duration::new(80, 0)), Duration::new(20, 0)); assert_eq!(Duration::new(100, 400_000_000).abs_diff(Duration::new(110, 0)), Duration::new(9, 600_000_000)); `... |
| saturating_sub | Saturating `Duration` subtraction. Computes `self - other`, returning [`Duration::ZERO`] if the result would be negative or if overflow occurred. # Examples ``` use std::time::Duration; assert_eq!(Duration::new(0, 1).saturating_sub(Duration::new(0, 0)), Duration::new(0, 1)); assert_eq!(Duration::new(0, 0).saturating_sub(Duration::new(0, 1)), Duration::ZERO); ``` |
| from_micros | Creates a new `Duration` from the specified number of microseconds. # Examples ``` use std::time::Duration; let duration = Duration::from_micros(1_000_002); assert_eq!(1, duration.as_secs()); assert_eq!(2_000, duration.subsec_nanos()); `... |
| subsec_nanos | Returns the fractional part of this `Duration`, in nanoseconds. This method does **not** return th... |
| as_secs_f64 | Returns the number of seconds contained by this `Duration` as `f64`. The returned value includes t... |
| as_micros | Returns the total number of whole microseconds contained by this `Duration`. # Examples ``` use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_micros(), 5_730_023); `... |
| from_secs_f32 | Creates a new `Duration` from the specified number of seconds represented as `f32`. # Panics Thi... |
| as_secs | Returns the number of _whole_ seconds contained by this `Duration`. The returned value does not in... |
| div_f64 | Divides `Duration` by `f64`. # Panics This method will panic if result is negative, overflows `Duration`... |
| as_millis | Returns the total number of whole milliseconds contained by this `Duration`. # Examples ``` use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_millis(), 5_730); ``` |
| div_duration_f64 | Divides `Duration` by `Duration` and returns `f64`. # Examples ``` use std::time::Duration; let dur1 = Duration::new(2, 700_000_000); let dur2 = Duration::new(5, 400_000_000); assert_eq!(dur1.div_duration_f64(dur2), 0.5); ``` |
| is_zero | Returns true if this `Duration` spans no time. # Examples ``` use std::time::Duration; assert!(Duration::ZERO.is_zero()); assert!(Duration::new(0, 0).is_zero()); assert!(Duration::from_nanos(0).is_zero()); assert!(Duration::from_secs(0).is_zero()); assert!(!Duration::new(1, 1).is_zero()); assert!(!Duration::from_nanos(1).is_zero()); assert!(!Duration::from_secs(1).is_zero()); ``` |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| from_millis | Creates a new `Duration` from the specified number of milliseconds. # Examples ``` use std::time::Duration; let duration = Duration::from_millis(2_569); assert_eq!(2, duration.as_secs()); assert_eq!(569_000_000, duration.subsec_nanos()); `... |
| sub | No Documentation 🚧 |
| from_secs | Creates a new `Duration` from the specified number of whole seconds. # Examples ``` use std::time::Duration; let duration = Duration::from_secs(5); assert_eq!(5, duration.as_secs()); assert_eq!(0, duration.subsec_nanos()); ``` |
| div_f32 | Divides `Duration` by `f32`. # Panics This method will panic if result is negative, overflows `Duration`... |
| eq | No Documentation 🚧 |
| subsec_millis | Returns the fractional part of this `Duration`, in whole milliseconds. This method does **not** re... |
| as_secs_f32 | Returns the number of seconds contained by this `Duration` as `f32`. The returned value includes t... |
| mul | No Documentation 🚧 |
| subsec_micros | Returns the fractional part of this `Duration`, in whole microseconds. This method does **not** re... |
div_duration_f32
Divides
DurationbyDurationand returnsf32.Examples
use std::time::Duration; let dur1 = Duration::new(2, 700_000_000); let dur2 = Duration::new(5, 400_000_000); assert_eq!(dur1.div_duration_f32(dur2), 0.5);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
as_nanos
Returns the total number of nanoseconds contained by this
Duration.Examples
use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_nanos(), 5_730_023_852);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Duration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u128 | No Documentation 🚧 |
mul_f64
Multiplies
Durationbyf64.Panics
This method will panic if result is negative, overflows
Durationor not finite.Examples
use std::time::Duration; let dur = Duration::new(2, 700_000_000); assert_eq!(dur.mul_f64(3.14), Duration::new(8, 478_000_000)); assert_eq!(dur.mul_f64(3.14e5), Duration::new(847_800, 0));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
saturating_mul
Saturating
Durationmultiplication. Computesself * other, returning [Duration::MAX] if overflow occurred.Examples
#![feature(duration_constants)] use std::time::Duration; assert_eq!(Duration::new(0, 500_000_001).saturating_mul(2), Duration::new(1, 2)); assert_eq!(Duration::new(u64::MAX - 1, 0).saturating_mul(2), Duration::MAX);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Duration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
saturating_add
Saturating
Durationaddition. Computesself + other, returning [Duration::MAX] if overflow occurred.Examples
#![feature(duration_constants)] use std::time::Duration; assert_eq!(Duration::new(0, 0).saturating_add(Duration::new(0, 1)), Duration::new(0, 1)); assert_eq!(Duration::new(1, 0).saturating_add(Duration::new(u64::MAX, 0)), Duration::MAX);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
new
Creates a new
Durationfrom the specified number of whole seconds and additional nanoseconds. If the number of nanoseconds is greater than 1 billion (the number of nanoseconds in a second), then it will carry over into the seconds provided.Panics
This constructor will panic if the carry from the nanoseconds overflows the seconds counter.
Examples
use std::time::Duration; let five_seconds = Duration::new(5, 0);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
mul_f32
Multiplies
Durationbyf32.Panics
This method will panic if result is negative, overflows
Durationor not finite.Examples
use std::time::Duration; let dur = Duration::new(2, 700_000_000); assert_eq!(dur.mul_f32(3.14), Duration::new(8, 478_000_641)); assert_eq!(dur.mul_f32(3.14e5), Duration::new(847_800, 0));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
from_secs_f64
Creates a new
Durationfrom the specified number of seconds represented asf64.Panics
This constructor will panic if
secsis negative, overflowsDurationor not finite.Examples
use std::time::Duration; let res = Duration::from_secs_f64(0.0); assert_eq!(res, Duration::new(0, 0)); let res = Duration::from_secs_f64(1e-20); assert_eq!(res, Duration::new(0, 0)); let res = Duration::from_secs_f64(4.2e-7); assert_eq!(res, Duration::new(0, 420)); let res = Duration::from_secs_f64(2.7); assert_eq!(res, Duration::new(2, 700_000_000)); let res = Duration::from_secs_f64(3e10); assert_eq!(res, Duration::new(30_000_000_000, 0)); // subnormal float let res = Duration::from_secs_f64(f64::from_bits(1)); assert_eq!(res, Duration::new(0, 0)); // conversion uses rounding let res = Duration::from_secs_f64(0.999e-9); assert_eq!(res, Duration::new(0, 1));
Arguments
| Name | Type | Documentation |
|---|---|---|
| secs | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
from_nanos
Creates a new
Durationfrom the specified number of nanoseconds. Note: Using this on the return value ofas_nanos()might cause unexpected behavior:as_nanos()returns a u128, and can return values that do not fit in u64, e.g. 585 years. Instead, consider using the patternDuration::new(d.as_secs(), d.subsec_nanos())if you cannot copy/clone the Duration directly.Examples
use std::time::Duration; let duration = Duration::from_nanos(1_000_000_123); assert_eq!(1, duration.as_secs()); assert_eq!(123, duration.subsec_nanos());
Arguments
| Name | Type | Documentation |
|---|---|---|
| nanos | u64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
abs_diff
Computes the absolute difference between
selfandother.Examples
use std::time::Duration; assert_eq!(Duration::new(100, 0).abs_diff(Duration::new(80, 0)), Duration::new(20, 0)); assert_eq!(Duration::new(100, 400_000_000).abs_diff(Duration::new(110, 0)), Duration::new(9, 600_000_000));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
saturating_sub
Saturating
Durationsubtraction. Computesself - other, returning [Duration::ZERO] if the result would be negative or if overflow occurred.Examples
use std::time::Duration; assert_eq!(Duration::new(0, 1).saturating_sub(Duration::new(0, 0)), Duration::new(0, 1)); assert_eq!(Duration::new(0, 0).saturating_sub(Duration::new(0, 1)), Duration::ZERO);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
from_micros
Creates a new
Durationfrom the specified number of microseconds.Examples
use std::time::Duration; let duration = Duration::from_micros(1_000_002); assert_eq!(1, duration.as_secs()); assert_eq!(2_000, duration.subsec_nanos());
Arguments
| Name | Type | Documentation |
|---|---|---|
| micros | u64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
subsec_nanos
Returns the fractional part of this
Duration, in nanoseconds. This method does not return the length of the duration when represented by nanoseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one billion).Examples
use std::time::Duration; let duration = Duration::from_millis(5_010); assert_eq!(duration.as_secs(), 5); assert_eq!(duration.subsec_nanos(), 10_000_000);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Duration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
as_secs_f64
Returns the number of seconds contained by this
Durationasf64. The returned value includes the fractional (nanosecond) part of the duration.Examples
use std::time::Duration; let dur = Duration::new(2, 700_000_000); assert_eq!(dur.as_secs_f64(), 2.7);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Duration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
as_micros
Returns the total number of whole microseconds contained by this
Duration.Examples
use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_micros(), 5_730_023);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Duration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u128 | No Documentation 🚧 |
from_secs_f32
Creates a new
Durationfrom the specified number of seconds represented asf32.Panics
This constructor will panic if
secsis negative, overflowsDurationor not finite.Examples
use std::time::Duration; let res = Duration::from_secs_f32(0.0); assert_eq!(res, Duration::new(0, 0)); let res = Duration::from_secs_f32(1e-20); assert_eq!(res, Duration::new(0, 0)); let res = Duration::from_secs_f32(4.2e-7); assert_eq!(res, Duration::new(0, 420)); let res = Duration::from_secs_f32(2.7); assert_eq!(res, Duration::new(2, 700_000_048)); let res = Duration::from_secs_f32(3e10); assert_eq!(res, Duration::new(30_000_001_024, 0)); // subnormal float let res = Duration::from_secs_f32(f32::from_bits(1)); assert_eq!(res, Duration::new(0, 0)); // conversion uses rounding let res = Duration::from_secs_f32(0.999e-9); assert_eq!(res, Duration::new(0, 1));
Arguments
| Name | Type | Documentation |
|---|---|---|
| secs | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
as_secs
Returns the number of whole seconds contained by this
Duration. The returned value does not include the fractional (nanosecond) part of the duration, which can be obtained using [subsec_nanos].Examples
use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_secs(), 5);To determine the total number of seconds represented by the
Durationincluding the fractional part, use [as_secs_f64] or [as_secs_f32] [as_secs_f64]: Duration::as_secs_f64 [as_secs_f32]: Duration::as_secs_f32 [subsec_nanos]: Duration::subsec_nanos
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Duration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
div_f64
Divides
Durationbyf64.Panics
This method will panic if result is negative, overflows
Durationor not finite.Examples
use std::time::Duration; let dur = Duration::new(2, 700_000_000); assert_eq!(dur.div_f64(3.14), Duration::new(0, 859_872_611)); assert_eq!(dur.div_f64(3.14e5), Duration::new(0, 8_599));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
as_millis
Returns the total number of whole milliseconds contained by this
Duration.Examples
use std::time::Duration; let duration = Duration::new(5, 730_023_852); assert_eq!(duration.as_millis(), 5_730);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Duration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u128 | No Documentation 🚧 |
div_duration_f64
Divides
DurationbyDurationand returnsf64.Examples
use std::time::Duration; let dur1 = Duration::new(2, 700_000_000); let dur2 = Duration::new(5, 400_000_000); assert_eq!(dur1.div_duration_f64(dur2), 0.5);
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
is_zero
Returns true if this
Durationspans no time.Examples
use std::time::Duration; assert!(Duration::ZERO.is_zero()); assert!(Duration::new(0, 0).is_zero()); assert!(Duration::from_nanos(0).is_zero()); assert!(Duration::from_secs(0).is_zero()); assert!(!Duration::new(1, 1).is_zero()); assert!(!Duration::from_nanos(1).is_zero()); assert!(!Duration::from_secs(1).is_zero());
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Duration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Duration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
from_millis
Creates a new
Durationfrom the specified number of milliseconds.Examples
use std::time::Duration; let duration = Duration::from_millis(2_569); assert_eq!(2, duration.as_secs()); assert_eq!(569_000_000, duration.subsec_nanos());
Arguments
| Name | Type | Documentation |
|---|---|---|
| millis | u64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
from_secs
Creates a new
Durationfrom the specified number of whole seconds.Examples
use std::time::Duration; let duration = Duration::from_secs(5); assert_eq!(5, duration.as_secs()); assert_eq!(0, duration.subsec_nanos());
Arguments
| Name | Type | Documentation |
|---|---|---|
| secs | u64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
div_f32
Divides
Durationbyf32.Panics
This method will panic if result is negative, overflows
Durationor not finite.Examples
use std::time::Duration; let dur = Duration::new(2, 700_000_000); // note that due to rounding errors result is slightly // different from 0.859_872_611 assert_eq!(dur.div_f32(3.14), Duration::new(0, 859_872_580)); assert_eq!(dur.div_f32(3.14e5), Duration::new(0, 8_599));
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
subsec_millis
Returns the fractional part of this
Duration, in whole milliseconds. This method does not return the length of the duration when represented by milliseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one thousand).Examples
use std::time::Duration; let duration = Duration::from_millis(5_432); assert_eq!(duration.as_secs(), 5); assert_eq!(duration.subsec_millis(), 432);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Duration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
as_secs_f32
Returns the number of seconds contained by this
Durationasf32. The returned value includes the fractional (nanosecond) part of the duration.Examples
use std::time::Duration; let dur = Duration::new(2, 700_000_000); assert_eq!(dur.as_secs_f32(), 2.7);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Duration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Duration | No Documentation 🚧 |
subsec_micros
Returns the fractional part of this
Duration, in whole microseconds. This method does not return the length of the duration when represented by microseconds. The returned number always represents a fractional portion of a second (i.e., it is less than one million).Examples
use std::time::Duration; let duration = Duration::from_micros(1_234_567); assert_eq!(duration.as_secs(), 1); assert_eq!(duration.subsec_micros(), 234_567);
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Duration | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
Affine2
Affine2
- matrix2:glam::Mat2
- translation:glam::Vec2
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| from_angle | Creates an affine transform from the given rotation `angle`. |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| transform_point2 | Transforms the given 2D point, applying shear, scale, rotation and translation. |
| from_scale_angle_translation | Creates an affine transform from the given 2D `scale`, rotation `angle` (in radians) and `translation`... |
| mul-2 | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| transform_vector2 | Transforms the given 2D vector, applying shear, scale and rotation (but NOT translation). To also... |
| from_mat3 | The given `Mat3` must be an affine transform, |
| from_mat2_translation | Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a transla... |
| from_scale | Creates an affine transform that changes scale. Note that if any scale is zero the transform will ... |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
| to_cols_array_2d | Creates a `[[f32; 2]; 3]` 2D array storing data in column major order. If you require data in row... |
| mul-1 | No Documentation 🚧 |
| is_nan | Returns `true` if any elements are `NaN`. |
| from_cols | Creates an affine transform from three column vectors. |
| inverse | Return the inverse of this transform. Note that if the transform is not invertible the result will... |
| mul | No Documentation 🚧 |
| from_mat3a | The given [`Mat3A`] must be an affine transform, |
| from_translation | Creates an affine transformation from the given 2D `translation`. |
| from_angle_translation | Creates an affine transform from the given 2D rotation `angle` (in radians) and `translation`. Eq... |
| from_mat2 | Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) |
| to_cols_array | Creates a `[f32; 6]` array storing data in column major order. |
from_angle
Creates an affine transform from the given rotation
angle.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two 3x4 matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine2 | No Documentation 🚧 |
| rhs | Affine2 | No Documentation 🚧 |
| max_abs_diff | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
transform_point2
Transforms the given 2D point, applying shear, scale, rotation and translation.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
from_scale_angle_translation
Creates an affine transform from the given 2D
scale, rotationangle(in radians) andtranslation. Equivalent toAffine2::from_translation(translation) * Affine2::from_angle(angle) * Affine2::from_scale(scale)
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | Vec2 | No Documentation 🚧 |
| angle | f32 | No Documentation 🚧 |
| translation | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
transform_vector2
Transforms the given 2D vector, applying shear, scale and rotation (but NOT translation). To also apply translation, use [
Self::transform_point2()] instead.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
from_mat3
The given
Mat3must be an affine transform,
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
from_mat2_translation
Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a translation vector. Equivalent to
Affine2::from_translation(translation) * Affine2::from_mat2(mat2)
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
from_scale
Creates an affine transform that changes scale. Note that if any scale is zero the transform will be non-invertible.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
to_cols_array_2d
Creates a
[[f32; 2]; 3]2D array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [[f32; 2]; 3] | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_cols
Creates an affine transform from three column vectors.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x_axis | Vec2 | No Documentation 🚧 |
| y_axis | Vec2 | No Documentation 🚧 |
| z_axis | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
inverse
Return the inverse of this transform. Note that if the transform is not invertible the result will be invalid.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
from_mat3a
The given [
Mat3A] must be an affine transform,
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
from_translation
Creates an affine transformation from the given 2D
translation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| translation | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
from_angle_translation
Creates an affine transform from the given 2D rotation
angle(in radians) andtranslation. Equivalent toAffine2::from_translation(translation) * Affine2::from_angle(angle)
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
from_mat2
Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation)
Arguments
| Name | Type | Documentation |
|---|---|---|
| matrix2 | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine2 | No Documentation 🚧 |
to_cols_array
Creates a
[f32; 6]array storing data in column major order.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f32; 6] | No Documentation 🚧 |
Affine3A
Affine3A
- matrix3:glam::Mat3A
- translation:glam::Vec3A
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| look_to_rh | Creates a right-handed view transform using a camera position, an up direction, and a facing direc... |
| from_rotation_x | Creates an affine transform containing a 3D rotation around the x axis of `angle` (in radians). |
| from_mat3 | Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) |
| clone | No Documentation 🚧 |
| transform_vector3 | Transforms the given 3D vector, applying shear, scale and rotation (but NOT translation). To also... |
| transform_point3 | Transforms the given 3D points, applying shear, scale, rotation and translation. |
| is_nan | Returns `true` if any elements are `NaN`. |
| inverse | Return the inverse of this transform. Note that if the transform is not invertible the result will... |
| mul | No Documentation 🚧 |
| to_cols_array_2d | Creates a `[[f32; 3]; 4]` 3D array storing data in column major order. If you require data in row... |
| from_mat4 | The given `Mat4` must be an affine transform, i.e. contain no perspective transform. |
| eq | No Documentation 🚧 |
| mul-1 | No Documentation 🚧 |
| from_rotation_y | Creates an affine transform containing a 3D rotation around the y axis of `angle` (in radians). |
| look_at_lh | Creates a left-handed view transform using a camera position, an up direction, and a focal point. ... |
| from_rotation_z | Creates an affine transform containing a 3D rotation around the z axis of `angle` (in radians). |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| look_at_rh | Creates a right-handed view transform using a camera position, an up direction, and a focal point.... |
| from_quat | Creates an affine transform from the given `rotation` quaternion. |
| transform_vector3a | Transforms the given [`Vec3A`], applying shear, scale and rotation (but NOT translation). To also apply translation, use [`Self::transform_point3a()`]... |
| from_scale | Creates an affine transform that changes scale. Note that if any scale is zero the transform will ... |
| from_cols | Creates an affine transform from three column vectors. |
| from_axis_angle | Creates an affine transform containing a 3D rotation around a normalized rotation `axis` of `angle... |
| look_to_lh | Creates a left-handed view transform using a camera position, an up direction, and a facing direct... |
| from_translation | Creates an affine transformation from the given 3D `translation`. |
| to_cols_array | Creates a `[f32; 12]` array storing data in column major order. |
| from_scale_rotation_translation | Creates an affine transform from the given 3D `scale`, `rotation` and `translation`. Equivalent t... |
| transform_point3a | Transforms the given [`Vec3A`], applying shear, scale, rotation and translation. |
| from_mat3_translation | Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) and a transla... |
| from_rotation_translation | Creates an affine transform from the given 3D `rotation` and `translation`. Equivalent to `Affine3A::from_translation(translation) * Affine3A::from_quat(rotation)` |
look_to_rh
Creates a right-handed view transform using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right,+Y=upand+Z=back.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
from_rotation_x
Creates an affine transform containing a 3D rotation around the x axis of
angle(in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
from_mat3
Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation)
Arguments
| Name | Type | Documentation |
|---|---|---|
| mat3 | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
transform_vector3
Transforms the given 3D vector, applying shear, scale and rotation (but NOT translation). To also apply translation, use [
Self::transform_point3()] instead.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
transform_point3
Transforms the given 3D points, applying shear, scale, rotation and translation.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
inverse
Return the inverse of this transform. Note that if the transform is not invertible the result will be invalid.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
to_cols_array_2d
Creates a
[[f32; 3]; 4]3D array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [[f32; 3]; 4] | No Documentation 🚧 |
from_mat4
The given
Mat4must be an affine transform, i.e. contain no perspective transform.
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
from_rotation_y
Creates an affine transform containing a 3D rotation around the y axis of
angle(in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
look_at_lh
Creates a left-handed view transform using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right,+Y=upand+Z=forward.Panics
Will panic if
upis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| eye | Vec3 | No Documentation 🚧 |
| center | Vec3 | No Documentation 🚧 |
| up | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
from_rotation_z
Creates an affine transform containing a 3D rotation around the z axis of
angle(in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two 3x4 matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine3A | No Documentation 🚧 |
| rhs | Affine3A | No Documentation 🚧 |
| max_abs_diff | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
look_at_rh
Creates a right-handed view transform using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right,+Y=upand+Z=back.Panics
Will panic if
upis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| eye | Vec3 | No Documentation 🚧 |
| center | Vec3 | No Documentation 🚧 |
| up | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
from_quat
Creates an affine transform from the given
rotationquaternion.
Arguments
| Name | Type | Documentation |
|---|---|---|
| rotation | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
transform_vector3a
Transforms the given [
Vec3A], applying shear, scale and rotation (but NOT translation). To also apply translation, use [Self::transform_point3a()] instead.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
from_scale
Creates an affine transform that changes scale. Note that if any scale is zero the transform will be non-invertible.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
from_cols
Creates an affine transform from three column vectors.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x_axis | Vec3A | No Documentation 🚧 |
| y_axis | Vec3A | No Documentation 🚧 |
| z_axis | Vec3A | No Documentation 🚧 |
| w_axis | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
from_axis_angle
Creates an affine transform containing a 3D rotation around a normalized rotation
axisofangle(in radians).
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
look_to_lh
Creates a left-handed view transform using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right,+Y=upand+Z=forward.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
from_translation
Creates an affine transformation from the given 3D
translation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| translation | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
to_cols_array
Creates a
[f32; 12]array storing data in column major order.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Affine3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f32; 12] | No Documentation 🚧 |
from_scale_rotation_translation
Creates an affine transform from the given 3D
scale,rotationandtranslation. Equivalent toAffine3A::from_translation(translation) * Affine3A::from_quat(rotation) * Affine3A::from_scale(scale)
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | Vec3 | No Documentation 🚧 |
| rotation | Quat | No Documentation 🚧 |
| translation | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
transform_point3a
Transforms the given [
Vec3A], applying shear, scale, rotation and translation.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
from_mat3_translation
Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) and a translation vector. Equivalent to
Affine3A::from_translation(translation) * Affine3A::from_mat3(mat3)
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
from_rotation_translation
Creates an affine transform from the given 3D
rotationandtranslation. Equivalent toAffine3A::from_translation(translation) * Affine3A::from_quat(rotation)
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Affine3A | No Documentation 🚧 |
BVec2
BVec2
- x:bool
- y:bool
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| all | Returns true if all the elements are true, false otherwise. |
| any | Returns true if any of the elements are true, false otherwise. |
| set | Sets the element at `index`. Panics if `index` is greater than 1. |
| bitmask | Returns a bitmask with the lowest 2 bits set from the elements of `self`. A true element results i... |
| clone | No Documentation 🚧 |
| new | Creates a new vector mask. |
| splat | Creates a vector mask with all elements set to `v`. |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| test | Tests the value at `index`. Panics if `index` is greater than 1. |
| from_array | Creates a new vector mask from a bool array. |
| eq | No Documentation 🚧 |
all
Returns true if all the elements are true, false otherwise.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
any
Returns true if any of the elements are true, false otherwise.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
set
Sets the element at
index. Panics ifindexis greater than 1.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec2 | No Documentation 🚧 |
| index | usize | No Documentation 🚧 |
| value | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
bitmask
Returns a bitmask with the lowest 2 bits set from the elements of
self. A true element results in a1bit and a false element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
new
Creates a new vector mask.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
splat
Creates a vector mask with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
test
Tests the value at
index. Panics ifindexis greater than 1.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_array
Creates a new vector mask from a bool array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [bool; 2] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
BVec3
BVec3
- x:bool
- y:bool
- z:bool
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| test | Tests the value at `index`. Panics if `index` is greater than 2. |
| eq | No Documentation 🚧 |
| set | Sets the element at `index`. Panics if `index` is greater than 2. |
| from_array | Creates a new vector mask from a bool array. |
| splat | Creates a vector mask with all elements set to `v`. |
| clone | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| all | Returns true if all the elements are true, false otherwise. |
| bitmask | Returns a bitmask with the lowest 3 bits set from the elements of `self`. A true element results i... |
| new | Creates a new vector mask. |
| any | Returns true if any of the elements are true, false otherwise. |
test
Tests the value at
index. Panics ifindexis greater than 2.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
set
Sets the element at
index. Panics ifindexis greater than 2.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec3 | No Documentation 🚧 |
| index | usize | No Documentation 🚧 |
| value | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
from_array
Creates a new vector mask from a bool array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [bool; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
splat
Creates a vector mask with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
all
Returns true if all the elements are true, false otherwise.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
bitmask
Returns a bitmask with the lowest 3 bits set from the elements of
self. A true element results in a1bit and a false element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
new
Creates a new vector mask.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
any
Returns true if any of the elements are true, false otherwise.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
BVec3A
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| from_array | Creates a new vector mask from a bool array. |
| all | Returns true if all the elements are true, false otherwise. |
| eq | No Documentation 🚧 |
| test | Tests the value at `index`. Panics if `index` is greater than 2. |
| new | Creates a new vector mask. |
| bitmask | Returns a bitmask with the lowest 3 bits set from the elements of `self`. A true element results i... |
| set | Sets the element at `index`. Panics if `index` is greater than 2. |
| any | Returns true if any of the elements are true, false otherwise. |
| clone | No Documentation 🚧 |
| splat | Creates a vector mask with all elements set to `v`. |
from_array
Creates a new vector mask from a bool array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [bool; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3A | No Documentation 🚧 |
all
Returns true if all the elements are true, false otherwise.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
test
Tests the value at
index. Panics ifindexis greater than 2.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Creates a new vector mask.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3A | No Documentation 🚧 |
bitmask
Returns a bitmask with the lowest 3 bits set from the elements of
self. A true element results in a1bit and a false element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
set
Sets the element at
index. Panics ifindexis greater than 2.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec3A | No Documentation 🚧 |
| index | usize | No Documentation 🚧 |
| value | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
any
Returns true if any of the elements are true, false otherwise.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3A | No Documentation 🚧 |
splat
Creates a vector mask with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3A | No Documentation 🚧 |
BVec4
BVec4
- x:bool
- y:bool
- z:bool
- w:bool
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| bitmask | Returns a bitmask with the lowest 4 bits set from the elements of `self`. A true element results i... |
| all | Returns true if all the elements are true, false otherwise. |
| splat | Creates a vector mask with all elements set to `v`. |
| from_array | Creates a new vector mask from a bool array. |
| test | Tests the value at `index`. Panics if `index` is greater than 3. |
| any | Returns true if any of the elements are true, false otherwise. |
| set | Sets the element at `index`. Panics if `index` is greater than 3. |
| eq | No Documentation 🚧 |
| new | Creates a new vector mask. |
| clone | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
bitmask
Returns a bitmask with the lowest 4 bits set from the elements of
self. A true element results in a1bit and a false element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
all
Returns true if all the elements are true, false otherwise.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
splat
Creates a vector mask with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
from_array
Creates a new vector mask from a bool array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [bool; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
test
Tests the value at
index. Panics ifindexis greater than 3.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
any
Returns true if any of the elements are true, false otherwise.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
set
Sets the element at
index. Panics ifindexis greater than 3.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec4 | No Documentation 🚧 |
| index | usize | No Documentation 🚧 |
| value | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Creates a new vector mask.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | bool | No Documentation 🚧 |
| y | bool | No Documentation 🚧 |
| z | bool | No Documentation 🚧 |
| w | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
BVec4A
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| set | Sets the element at `index`. Panics if `index` is greater than 3. |
| any | Returns true if any of the elements are true, false otherwise. |
| from_array | Creates a new vector mask from a bool array. |
| all | Returns true if all the elements are true, false otherwise. |
| splat | Creates a vector mask with all elements set to `v`. |
| test | Tests the value at `index`. Panics if `index` is greater than 3. |
| eq | No Documentation 🚧 |
| bitmask | Returns a bitmask with the lowest 4 bits set from the elements of `self`. A true element results i... |
| clone | No Documentation 🚧 |
| new | Creates a new vector mask. |
set
Sets the element at
index. Panics ifindexis greater than 3.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec4A | No Documentation 🚧 |
| index | usize | No Documentation 🚧 |
| value | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
any
Returns true if any of the elements are true, false otherwise.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec4A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_array
Creates a new vector mask from a bool array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [bool; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4A | No Documentation 🚧 |
all
Returns true if all the elements are true, false otherwise.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec4A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
splat
Creates a vector mask with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4A | No Documentation 🚧 |
test
Tests the value at
index. Panics ifindexis greater than 3.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
bitmask
Returns a bitmask with the lowest 4 bits set from the elements of
self. A true element results in a1bit and a false element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec4A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | BVec4A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4A | No Documentation 🚧 |
new
Creates a new vector mask.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | bool | No Documentation 🚧 |
| y | bool | No Documentation 🚧 |
| z | bool | No Documentation 🚧 |
| w | bool | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4A | No Documentation 🚧 |
DAffine2
DAffine2
- matrix2:glam::DMat2
- translation:glam::DVec2
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| from_translation | Creates an affine transformation from the given 2D `translation`. |
| from_cols | Creates an affine transform from three column vectors. |
| to_cols_array_2d | Creates a `[[f64; 2]; 3]` 2D array storing data in column major order. If you require data in row... |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| from_mat3 | The given `DMat3` must be an affine transform, |
| transform_vector2 | Transforms the given 2D vector, applying shear, scale and rotation (but NOT translation). To also... |
| from_scale | Creates an affine transform that changes scale. Note that if any scale is zero the transform will ... |
| mul-1 | No Documentation 🚧 |
| to_cols_array | Creates a `[f64; 6]` array storing data in column major order. |
| from_scale_angle_translation | Creates an affine transform from the given 2D `scale`, rotation `angle` (in radians) and `translation`... |
| inverse | Return the inverse of this transform. Note that if the transform is not invertible the result will... |
| clone | No Documentation 🚧 |
| from_angle_translation | Creates an affine transform from the given 2D rotation `angle` (in radians) and `translation`. Eq... |
| is_nan | Returns `true` if any elements are `NaN`. |
| from_mat2_translation | Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a transla... |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
| from_angle | Creates an affine transform from the given rotation `angle`. |
| from_mat2 | Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) |
| eq | No Documentation 🚧 |
| transform_point2 | Transforms the given 2D point, applying shear, scale, rotation and translation. |
| mul | No Documentation 🚧 |
from_translation
Creates an affine transformation from the given 2D
translation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| translation | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine2 | No Documentation 🚧 |
from_cols
Creates an affine transform from three column vectors.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x_axis | DVec2 | No Documentation 🚧 |
| y_axis | DVec2 | No Documentation 🚧 |
| z_axis | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine2 | No Documentation 🚧 |
to_cols_array_2d
Creates a
[[f64; 2]; 3]2D array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [[f64; 2]; 3] | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two 3x4 matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine2 | No Documentation 🚧 |
| rhs | DAffine2 | No Documentation 🚧 |
| max_abs_diff | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_mat3
The given
DMat3must be an affine transform,
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine2 | No Documentation 🚧 |
transform_vector2
Transforms the given 2D vector, applying shear, scale and rotation (but NOT translation). To also apply translation, use [
Self::transform_point2()] instead.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
from_scale
Creates an affine transform that changes scale. Note that if any scale is zero the transform will be non-invertible.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
to_cols_array
Creates a
[f64; 6]array storing data in column major order.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f64; 6] | No Documentation 🚧 |
from_scale_angle_translation
Creates an affine transform from the given 2D
scale, rotationangle(in radians) andtranslation. Equivalent toDAffine2::from_translation(translation) * DAffine2::from_angle(angle) * DAffine2::from_scale(scale)
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | DVec2 | No Documentation 🚧 |
| angle | f64 | No Documentation 🚧 |
| translation | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine2 | No Documentation 🚧 |
inverse
Return the inverse of this transform. Note that if the transform is not invertible the result will be invalid.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine2 | No Documentation 🚧 |
from_angle_translation
Creates an affine transform from the given 2D rotation
angle(in radians) andtranslation. Equivalent toDAffine2::from_translation(translation) * DAffine2::from_angle(angle)
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine2 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_mat2_translation
Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a translation vector. Equivalent to
DAffine2::from_translation(translation) * DAffine2::from_mat2(mat2)
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine2 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_angle
Creates an affine transform from the given rotation
angle.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine2 | No Documentation 🚧 |
from_mat2
Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation)
Arguments
| Name | Type | Documentation |
|---|---|---|
| matrix2 | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
transform_point2
Transforms the given 2D point, applying shear, scale, rotation and translation.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine2 | No Documentation 🚧 |
DAffine3
DAffine3
- matrix3:glam::DMat3
- translation:glam::DVec3
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| from_rotation_y | Creates an affine transform containing a 3D rotation around the y axis of `angle` (in radians). |
| from_cols | Creates an affine transform from three column vectors. |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| look_at_rh | Creates a right-handed view transform using a camera position, an up direction, and a focal point.... |
| mul-1 | No Documentation 🚧 |
| from_quat | Creates an affine transform from the given `rotation` quaternion. |
| from_rotation_x | Creates an affine transform containing a 3D rotation around the x axis of `angle` (in radians). |
| from_mat4 | The given `DMat4` must be an affine transform, i.e. contain no perspective transform. |
| clone | No Documentation 🚧 |
| from_rotation_translation | Creates an affine transform from the given 3D `rotation` and `translation`. Equivalent to `DAffine3::from_translation(translation) * DAffine3::from_quat(rotation)` |
| inverse | Return the inverse of this transform. Note that if the transform is not invertible the result will... |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
| look_at_lh | Creates a left-handed view transform using a camera position, an up direction, and a focal point. ... |
| transform_point3 | Transforms the given 3D points, applying shear, scale, rotation and translation. |
| from_scale_rotation_translation | Creates an affine transform from the given 3D `scale`, `rotation` and `translation`. Equivalent t... |
| from_rotation_z | Creates an affine transform containing a 3D rotation around the z axis of `angle` (in radians). |
| mul | No Documentation 🚧 |
| from_scale | Creates an affine transform that changes scale. Note that if any scale is zero the transform will ... |
| to_cols_array | Creates a `[f64; 12]` array storing data in column major order. |
| to_cols_array_2d | Creates a `[[f64; 3]; 4]` 3D array storing data in column major order. If you require data in row... |
| transform_vector3 | Transforms the given 3D vector, applying shear, scale and rotation (but NOT translation). To also... |
| from_translation | Creates an affine transformation from the given 3D `translation`. |
| look_to_lh | Creates a left-handed view transform using a camera position, an up direction, and a facing direct... |
| from_axis_angle | Creates an affine transform containing a 3D rotation around a normalized rotation `axis` of `angle... |
| from_mat3_translation | Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) and a transla... |
| is_nan | Returns `true` if any elements are `NaN`. |
| from_mat3 | Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) |
| look_to_rh | Creates a right-handed view transform using a camera position, an up direction, and a facing direc... |
| eq | No Documentation 🚧 |
from_rotation_y
Creates an affine transform containing a 3D rotation around the y axis of
angle(in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
from_cols
Creates an affine transform from three column vectors.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x_axis | DVec3 | No Documentation 🚧 |
| y_axis | DVec3 | No Documentation 🚧 |
| z_axis | DVec3 | No Documentation 🚧 |
| w_axis | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two 3x4 matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine3 | No Documentation 🚧 |
| rhs | DAffine3 | No Documentation 🚧 |
| max_abs_diff | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
look_at_rh
Creates a right-handed view transform using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right,+Y=upand+Z=back.Panics
Will panic if
upis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| eye | DVec3 | No Documentation 🚧 |
| center | DVec3 | No Documentation 🚧 |
| up | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
from_quat
Creates an affine transform from the given
rotationquaternion.
Arguments
| Name | Type | Documentation |
|---|---|---|
| rotation | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
from_rotation_x
Creates an affine transform containing a 3D rotation around the x axis of
angle(in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
from_mat4
The given
DMat4must be an affine transform, i.e. contain no perspective transform.
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
from_rotation_translation
Creates an affine transform from the given 3D
rotationandtranslation. Equivalent toDAffine3::from_translation(translation) * DAffine3::from_quat(rotation)
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
inverse
Return the inverse of this transform. Note that if the transform is not invertible the result will be invalid.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
look_at_lh
Creates a left-handed view transform using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right,+Y=upand+Z=forward.Panics
Will panic if
upis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| eye | DVec3 | No Documentation 🚧 |
| center | DVec3 | No Documentation 🚧 |
| up | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
transform_point3
Transforms the given 3D points, applying shear, scale, rotation and translation.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
from_scale_rotation_translation
Creates an affine transform from the given 3D
scale,rotationandtranslation. Equivalent toDAffine3::from_translation(translation) * DAffine3::from_quat(rotation) * DAffine3::from_scale(scale)
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | DVec3 | No Documentation 🚧 |
| rotation | DQuat | No Documentation 🚧 |
| translation | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
from_rotation_z
Creates an affine transform containing a 3D rotation around the z axis of
angle(in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
from_scale
Creates an affine transform that changes scale. Note that if any scale is zero the transform will be non-invertible.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
to_cols_array
Creates a
[f64; 12]array storing data in column major order.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f64; 12] | No Documentation 🚧 |
to_cols_array_2d
Creates a
[[f64; 3]; 4]3D array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [[f64; 3]; 4] | No Documentation 🚧 |
transform_vector3
Transforms the given 3D vector, applying shear, scale and rotation (but NOT translation). To also apply translation, use [
Self::transform_point3()] instead.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
from_translation
Creates an affine transformation from the given 3D
translation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| translation | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
look_to_lh
Creates a left-handed view transform using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right,+Y=upand+Z=forward.
Arguments
| Name | Type | Documentation |
|---|---|---|
| eye | DVec3 | No Documentation 🚧 |
| dir | DVec3 | No Documentation 🚧 |
| up | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
from_axis_angle
Creates an affine transform containing a 3D rotation around a normalized rotation
axisofangle(in radians).
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
from_mat3_translation
Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) and a translation vector. Equivalent to
DAffine3::from_translation(translation) * DAffine3::from_mat3(mat3)
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DAffine3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_mat3
Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation)
Arguments
| Name | Type | Documentation |
|---|---|---|
| mat3 | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
look_to_rh
Creates a right-handed view transform using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right,+Y=upand+Z=back.
Arguments
| Name | Type | Documentation |
|---|---|---|
| eye | DVec3 | No Documentation 🚧 |
| dir | DVec3 | No Documentation 🚧 |
| up | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DAffine3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
DMat2
DMat2
- x_axis:glam::DVec2
- y_axis:glam::DVec2
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| mul_scalar | Multiplies a 2x2 matrix by a scalar. |
| div_scalar | Divides a 2x2 matrix by a scalar. |
| from_cols | Creates a 2x2 matrix from two column vectors. |
| mul-2 | No Documentation 🚧 |
| inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
| abs | Takes the absolute value of each element in `self` |
| transpose | Returns the transpose of `self`. |
| determinant | Returns the determinant of `self`. |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| is_nan | Returns `true` if any elements are `NaN`. |
| neg | No Documentation 🚧 |
| from_mat3 | Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. |
| as_mat2 | No Documentation 🚧 |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
| clone | No Documentation 🚧 |
| from_mat3_minor | Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column and `j`th... |
| sub | No Documentation 🚧 |
| sub_mat2 | Subtracts two 2x2 matrices. |
| from_angle | Creates a 2x2 matrix containing a rotation of `angle` (in radians). |
| add | No Documentation 🚧 |
| row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 1. |
| add_mat2 | Adds two 2x2 matrices. |
| mul_mat2 | Multiplies two 2x2 matrices. |
| mul_vec2 | Transforms a 2D vector. |
| div | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 1. |
| mul | No Documentation 🚧 |
| to_cols_array_2d | Creates a `[[f64; 2]; 2]` 2D array storing data in column major order. If you require data in row ... |
| mul-1 | No Documentation 🚧 |
| from_scale_angle | Creates a 2x2 matrix containing the combining non-uniform `scale` and rotation of `angle` (in radi... |
| from_diagonal | Creates a 2x2 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
| to_cols_array | Creates a `[f64; 4]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
mul_scalar
Multiplies a 2x2 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
div_scalar
Divides a 2x2 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
from_cols
Creates a 2x2 matrix from two column vectors.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
inverse
Returns the inverse of
self. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
selfis zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
transpose
Returns the transpose of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
determinant
Returns the determinant of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat2 | No Documentation 🚧 |
| rhs | DMat2 | No Documentation 🚧 |
| max_abs_diff | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
from_mat3
Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
as_mat2
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
from_mat3_minor
Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the
ith column andjth row.Panics
Panics if
iorjis greater than 2.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
sub_mat2
Subtracts two 2x2 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
from_angle
Creates a 2x2 matrix containing a rotation of
angle(in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
row
Returns the matrix row for the given
index.Panics
Panics if
indexis greater than 1.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
add_mat2
Adds two 2x2 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
mul_mat2
Multiplies two 2x2 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
mul_vec2
Transforms a 2D vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
col
Returns the matrix column for the given
index.Panics
Panics if
indexis greater than 1.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
to_cols_array_2d
Creates a
[[f64; 2]; 2]2D array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [[f64; 2]; 2] | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
from_scale_angle
Creates a 2x2 matrix containing the combining non-uniform
scaleand rotation ofangle(in radians).
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
from_diagonal
Creates a 2x2 matrix with its diagonal set to
diagonaland all other entries set to 0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| diagonal | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
to_cols_array
Creates a
[f64; 4]array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f64; 4] | No Documentation 🚧 |
DMat3
DMat3
- x_axis:glam::DVec3
- y_axis:glam::DVec3
- z_axis:glam::DVec3
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 2. |
| from_mat4 | Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. |
| mul-1 | No Documentation 🚧 |
| is_nan | Returns `true` if any elements are `NaN`. |
| from_scale | Creates an affine transformation matrix from the given non-uniform 2D `scale`. The resulting matri... |
| mul | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| mul-3 | No Documentation 🚧 |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| from_cols | Creates a 3x3 matrix from three column vectors. |
| neg | No Documentation 🚧 |
| div_scalar | Divides a 3x3 matrix by a scalar. |
| div | No Documentation 🚧 |
| abs | Takes the absolute value of each element in `self` |
| from_mat4_minor | Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the `i`th column and `j`th... |
| inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
| from_translation | Creates an affine transformation matrix from the given 2D `translation`. The resulting matrix can ... |
| as_mat3 | No Documentation 🚧 |
| from_axis_angle | Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in radians). # Panics... |
| mul_scalar | Multiplies a 3x3 matrix by a scalar. |
| add_mat3 | Adds two 3x3 matrices. |
| mul-2 | No Documentation 🚧 |
| mul_vec3 | Transforms a 3D vector. |
| transform_point2 | Transforms the given 2D vector as a point. This is the equivalent of multiplying `rhs` as a 3D vec... |
| from_rotation_z | Creates a 3D rotation matrix from `angle` (in radians) around the z axis. |
| determinant | Returns the determinant of `self`. |
| transform_vector2 | Rotates the given 2D vector. This is the equivalent of multiplying `rhs` as a 3D vector where `z` ... |
| row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 2. |
| sub_mat3 | Subtracts two 3x3 matrices. |
| from_rotation_x | Creates a 3D rotation matrix from `angle` (in radians) around the x axis. |
| to_cols_array_2d | Creates a `[[f64; 3]; 3]` 3D array storing data in column major order. If you require data in row ... |
| clone | No Documentation 🚧 |
| from_angle | Creates an affine transformation matrix from the given 2D rotation `angle` (in radians). The resu... |
| transpose | Returns the transpose of `self`. |
| from_scale_angle_translation | Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in radians) a... |
| sub | No Documentation 🚧 |
| to_euler | Extract Euler angles with the given Euler rotation order. Note if the input matrix contains scales... |
| from_mat2 | Creates an affine transformation matrix from the given 2x2 matrix. The resulting matrix can be use... |
| add | No Documentation 🚧 |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
| from_quat | Creates a 3D rotation matrix from the given quaternion. # Panics Will panic if `rotation` is not ... |
| from_euler | Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians). |
| from_rotation_y | Creates a 3D rotation matrix from `angle` (in radians) around the y axis. |
| mul_mat3 | Multiplies two 3x3 matrices. |
| to_cols_array | Creates a `[f64; 9]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
| from_diagonal | Creates a 3x3 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
col
Returns the matrix column for the given
index.Panics
Panics if
indexis greater than 2.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
from_mat4
Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column.
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_scale
Creates an affine transformation matrix from the given non-uniform 2D
scale. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()] and [Self::transform_vector2()].Panics
Will panic if all elements of
scaleare zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat3 | No Documentation 🚧 |
| rhs | DMat3 | No Documentation 🚧 |
| max_abs_diff | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_cols
Creates a 3x3 matrix from three column vectors.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x_axis | DVec3 | No Documentation 🚧 |
| y_axis | DVec3 | No Documentation 🚧 |
| z_axis | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
div_scalar
Divides a 3x3 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
from_mat4_minor
Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the
ith column andjth row.Panics
Panics if
iorjis greater than 3.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
inverse
Returns the inverse of
self. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
selfis zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
from_translation
Creates an affine transformation matrix from the given 2D
translation. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()] and [Self::transform_vector2()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| translation | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
as_mat3
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
from_axis_angle
Creates a 3D rotation matrix from a normalized rotation
axisandangle(in radians).Panics
Will panic if
axisis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
mul_scalar
Multiplies a 3x3 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
add_mat3
Adds two 3x3 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
mul_vec3
Transforms a 3D vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
transform_point2
Transforms the given 2D vector as a point. This is the equivalent of multiplying
rhsas a 3D vector wherezis1. This method assumes thatselfcontains a valid affine transform.Panics
Will panic if the 2nd row of
selfis not(0, 0, 1)whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
from_rotation_z
Creates a 3D rotation matrix from
angle(in radians) around the z axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
determinant
Returns the determinant of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
transform_vector2
Rotates the given 2D vector. This is the equivalent of multiplying
rhsas a 3D vector wherezis0. This method assumes thatselfcontains a valid affine transform.Panics
Will panic if the 2nd row of
selfis not(0, 0, 1)whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
row
Returns the matrix row for the given
index.Panics
Panics if
indexis greater than 2.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
sub_mat3
Subtracts two 3x3 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
from_rotation_x
Creates a 3D rotation matrix from
angle(in radians) around the x axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
to_cols_array_2d
Creates a
[[f64; 3]; 3]3D array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [[f64; 3]; 3] | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
from_angle
Creates an affine transformation matrix from the given 2D rotation
angle(in radians). The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()] and [Self::transform_vector2()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
transpose
Returns the transpose of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
from_scale_angle_translation
Creates an affine transformation matrix from the given 2D
scale, rotationangle(in radians) andtranslation. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()] and [Self::transform_vector2()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | DVec2 | No Documentation 🚧 |
| angle | f64 | No Documentation 🚧 |
| translation | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
to_euler
Extract Euler angles with the given Euler rotation order. Note if the input matrix contains scales, shears, or other non-rotation transformations then the resulting Euler angles will be ill-defined.
Panics
Will panic if any input matrix column is not normalized when
glam_assertis enabled.
Arguments
Returns
from_mat2
Creates an affine transformation matrix from the given 2x2 matrix. The resulting matrix can be used to transform 2D points and vectors. See [
Self::transform_point2()] and [Self::transform_vector2()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | DMat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_quat
Creates a 3D rotation matrix from the given quaternion.
Panics
Will panic if
rotationis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| rotation | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
from_euler
Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| order | EulerRot | No Documentation 🚧 |
| a | f64 | No Documentation 🚧 |
| b | f64 | No Documentation 🚧 |
| c | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
from_rotation_y
Creates a 3D rotation matrix from
angle(in radians) around the y axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
mul_mat3
Multiplies two 3x3 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
to_cols_array
Creates a
[f64; 9]array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f64; 9] | No Documentation 🚧 |
from_diagonal
Creates a 3x3 matrix with its diagonal set to
diagonaland all other entries set to 0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| diagonal | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
DMat4
DMat4
- x_axis:glam::DVec4
- y_axis:glam::DVec4
- z_axis:glam::DVec4
- w_axis:glam::DVec4
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| from_rotation_x | Creates an affine transformation matrix containing a 3D rotation around the x axis of `angle` (in ... |
| from_scale | Creates an affine transformation matrix containing the given 3D non-uniform `scale`. The resulting... |
| row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 3. |
| mul-3 | No Documentation 🚧 |
| orthographic_lh | Creates a left-handed orthographic projection matrix with `[0,1]` depth range. Useful to map a left-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect. |
| from_rotation_y | Creates an affine transformation matrix containing a 3D rotation around the y axis of `angle` (in ... |
| perspective_infinite_lh | Creates an infinite left-handed perspective projection matrix with `[0,1]` depth range. Like `perspective_lh`, but with an infinite value for `z_far`. The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
| div | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| from_rotation_translation | Creates an affine transformation matrix from the given 3D `translation`. The resulting matrix can ... |
| neg | No Documentation 🚧 |
| from_euler | Creates a affine transformation matrix containing a rotation from the given euler rotation sequenc... |
| from_diagonal | Creates a 4x4 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| add | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| mul_mat4 | Multiplies two 4x4 matrices. |
| look_at_rh | Creates a right-handed view matrix using a camera position, an up direction, and a focal point. F... |
| perspective_rh_gl | Creates a right-handed perspective projection matrix with `[-1,1]` depth range. Useful to map the standard right-handed coordinate system into what OpenGL expects. This is the same as the OpenGL `gluPerspective` function. See https://www\.khronos\.org/registry/OpenGL\-Refpages/gl2\.1/xhtml/gluPerspective\.xml |
| transform_vector3 | Transforms the give 3D vector as a direction. This is the equivalent of multiplying the 3D vector ... |
| from_mat3 | Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resu... |
| from_scale_rotation_translation | Creates an affine transformation matrix from the given 3D `scale`, `rotation` and `translation`. ... |
| determinant | Returns the determinant of `self`. |
| from_quat | Creates an affine transformation matrix from the given `rotation` quaternion. The resulting matrix... |
| transform_point3 | Transforms the given 3D vector as a point. This is the equivalent of multiplying the 3D vector as ... |
| perspective_rh | Creates a right-handed perspective projection matrix with `[0,1]` depth range. Useful to map the standard right-handed coordinate system into what WebGPU/Metal/Direct3D expect. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
| project_point3 | Transforms the given 3D vector as a point, applying perspective correction. This is the equivalent... |
| to_euler | Extract Euler angles with the given Euler rotation order. Note if the upper 3x3 matrix contain sca... |
| add_mat4 | Adds two 4x4 matrices. |
| look_at_lh | Creates a left-handed view matrix using a camera position, an up direction, and a focal point. Fo... |
| sub_mat4 | Subtracts two 4x4 matrices. |
| transpose | Returns the transpose of `self`. |
| from_axis_angle | Creates an affine transformation matrix containing a 3D rotation around a normalized rotation `axis`... |
| look_to_lh | Creates a left-handed view matrix using a camera position, an up direction, and a facing direction... |
| from_translation | Creates an affine transformation matrix from the given 3D `translation`. The resulting matrix can ... |
| div_scalar | Divides a 4x4 matrix by a scalar. |
| perspective_lh | Creates a left-handed perspective projection matrix with `[0,1]` depth range. Useful to map the standard left-handed coordinate system into what WebGPU/Metal/Direct3D expect. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
| inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
| mul_scalar | Multiplies a 4x4 matrix by a scalar. |
| perspective_infinite_reverse_lh | Creates an infinite reverse left-handed perspective projection matrix with `[0,1]` depth range. Similar to `perspective_infinite_lh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. # Panics Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. |
| from_cols | Creates a 4x4 matrix from four column vectors. |
| abs | Takes the absolute value of each element in `self` |
| orthographic_rh_gl | Creates a right-handed orthographic projection matrix with `[-1,1]` depth range. This is the same as the OpenGL `glOrtho` function in OpenGL. See https://www\.khronos\.org/registry/OpenGL\-Refpages/gl2\.1/xhtml/glOrtho\.xml Useful to map a right-handed coordinate system to the normalized device coordinates that OpenGL expects. |
| is_nan | Returns `true` if any elements are `NaN`. |
| sub | No Documentation 🚧 |
| mul-1 | No Documentation 🚧 |
| col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 3. |
| look_to_rh | Creates a right-handed view matrix using a camera position, an up direction, and a facing directio... |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
| mul-2 | No Documentation 🚧 |
| as_mat4 | No Documentation 🚧 |
| mul_vec4 | Transforms a 4D vector. |
| from_rotation_z | Creates an affine transformation matrix containing a 3D rotation around the z axis of `angle` (in ... |
| to_cols_array | Creates a `[f64; 16]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
| perspective_infinite_reverse_rh | Creates an infinite reverse right-handed perspective projection matrix with `[0,1]` depth range. Similar to `perspective_infinite_rh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. # Panics Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. |
| perspective_infinite_rh | Creates an infinite right-handed perspective projection matrix with `[0,1]` depth range. Like `perspective_rh`, but with an infinite value for `z_far`. The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
| to_cols_array_2d | Creates a `[[f64; 4]; 4]` 4D array storing data in column major order. If you require data in row ... |
| orthographic_rh | Creates a right-handed orthographic projection matrix with `[0,1]` depth range. Useful to map a right-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect. |
from_rotation_x
Creates an affine transformation matrix containing a 3D rotation around the x axis of
angle(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
from_scale
Creates an affine transformation matrix containing the given 3D non-uniform
scale. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].Panics
Will panic if all elements of
scaleare zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
row
Returns the matrix row for the given
index.Panics
Panics if
indexis greater than 3.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
orthographic_lh
Creates a left-handed orthographic projection matrix with
[0,1]depth range. Useful to map a left-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect.
Arguments
| Name | Type | Documentation |
|---|---|---|
| left | f64 | No Documentation 🚧 |
| right | f64 | No Documentation 🚧 |
| bottom | f64 | No Documentation 🚧 |
| top | f64 | No Documentation 🚧 |
| near | f64 | No Documentation 🚧 |
| far | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
from_rotation_y
Creates an affine transformation matrix containing a 3D rotation around the y axis of
angle(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
perspective_infinite_lh
Creates an infinite left-handed perspective projection matrix with
[0,1]depth range. Likeperspective_lh, but with an infinite value forz_far. The result is that points nearz_nearare mapped to depth0, and as they move towards infinity the depth approaches1.Panics
Will panic if
z_nearorz_farare less than or equal to zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f64 | No Documentation 🚧 |
| aspect_ratio | f64 | No Documentation 🚧 |
| z_near | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
from_rotation_translation
Creates an affine transformation matrix from the given 3D
translation. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].Panics
Will panic if
rotationis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
from_euler
Creates a affine transformation matrix containing a rotation from the given euler rotation sequence and angles (in radians). The resulting matrix can be used to transform 3D points and vectors. See [
Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| order | EulerRot | No Documentation 🚧 |
| a | f64 | No Documentation 🚧 |
| b | f64 | No Documentation 🚧 |
| c | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
from_diagonal
Creates a 4x4 matrix with its diagonal set to
diagonaland all other entries set to 0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| diagonal | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat4 | No Documentation 🚧 |
| rhs | DMat4 | No Documentation 🚧 |
| max_abs_diff | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
mul_mat4
Multiplies two 4x4 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
look_at_rh
Creates a right-handed view matrix using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right,+Y=upand+Z=back.Panics
Will panic if
upis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| eye | DVec3 | No Documentation 🚧 |
| center | DVec3 | No Documentation 🚧 |
| up | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
perspective_rh_gl
Creates a right-handed perspective projection matrix with
[-1,1]depth range. Useful to map the standard right-handed coordinate system into what OpenGL expects. This is the same as the OpenGLgluPerspectivefunction. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f64 | No Documentation 🚧 |
| aspect_ratio | f64 | No Documentation 🚧 |
| z_near | f64 | No Documentation 🚧 |
| z_far | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
transform_vector3
Transforms the give 3D vector as a direction. This is the equivalent of multiplying the 3D vector as a 4D vector where
wis0.0. This method assumes thatselfcontains a valid affine transform.Panics
Will panic if the 3rd row of
selfis not(0, 0, 0, 1)whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
from_mat3
Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resulting matrix can be used to transform 3D points and vectors. See [
Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
from_scale_rotation_translation
Creates an affine transformation matrix from the given 3D
scale,rotationandtranslation. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].Panics
Will panic if
rotationis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | DVec3 | No Documentation 🚧 |
| rotation | DQuat | No Documentation 🚧 |
| translation | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
determinant
Returns the determinant of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
from_quat
Creates an affine transformation matrix from the given
rotationquaternion. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].Panics
Will panic if
rotationis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| rotation | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
transform_point3
Transforms the given 3D vector as a point. This is the equivalent of multiplying the 3D vector as a 4D vector where
wis1.0. This method assumes thatselfcontains a valid affine transform. It does not perform a perspective divide, ifselfcontains a perspective transform, or if you are unsure, the [Self::project_point3()] method should be used instead.Panics
Will panic if the 3rd row of
selfis not(0, 0, 0, 1)whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
perspective_rh
Creates a right-handed perspective projection matrix with
[0,1]depth range. Useful to map the standard right-handed coordinate system into what WebGPU/Metal/Direct3D expect.Panics
Will panic if
z_nearorz_farare less than or equal to zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f64 | No Documentation 🚧 |
| aspect_ratio | f64 | No Documentation 🚧 |
| z_near | f64 | No Documentation 🚧 |
| z_far | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
project_point3
Transforms the given 3D vector as a point, applying perspective correction. This is the equivalent of multiplying the 3D vector as a 4D vector where
wis1.0. The perspective divide is performed meaning the resulting 3D vector is divided byw. This method assumes thatselfcontains a projective transform.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
to_euler
Extract Euler angles with the given Euler rotation order. Note if the upper 3x3 matrix contain scales, shears, or other non-rotation transformations then the resulting Euler angles will be ill-defined.
Panics
Will panic if any column of the upper 3x3 rotation matrix is not normalized when
glam_assertis enabled.
Arguments
Returns
add_mat4
Adds two 4x4 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
look_at_lh
Creates a left-handed view matrix using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right,+Y=upand+Z=forward.Panics
Will panic if
upis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| eye | DVec3 | No Documentation 🚧 |
| center | DVec3 | No Documentation 🚧 |
| up | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
sub_mat4
Subtracts two 4x4 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
transpose
Returns the transpose of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
from_axis_angle
Creates an affine transformation matrix containing a 3D rotation around a normalized rotation
axisofangle(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].Panics
Will panic if
axisis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
look_to_lh
Creates a left-handed view matrix using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right,+Y=upand+Z=forward.
Arguments
| Name | Type | Documentation |
|---|---|---|
| eye | DVec3 | No Documentation 🚧 |
| dir | DVec3 | No Documentation 🚧 |
| up | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
from_translation
Creates an affine transformation matrix from the given 3D
translation. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| translation | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
div_scalar
Divides a 4x4 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
perspective_lh
Creates a left-handed perspective projection matrix with
[0,1]depth range. Useful to map the standard left-handed coordinate system into what WebGPU/Metal/Direct3D expect.Panics
Will panic if
z_nearorz_farare less than or equal to zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f64 | No Documentation 🚧 |
| aspect_ratio | f64 | No Documentation 🚧 |
| z_near | f64 | No Documentation 🚧 |
| z_far | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
inverse
Returns the inverse of
self. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
selfis zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
mul_scalar
Multiplies a 4x4 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
perspective_infinite_reverse_lh
Creates an infinite reverse left-handed perspective projection matrix with
[0,1]depth range. Similar toperspective_infinite_lh, but mapsZ = z_nearto a depth of1andZ = infinityto a depth of0.Panics
Will panic if
z_nearis less than or equal to zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f64 | No Documentation 🚧 |
| aspect_ratio | f64 | No Documentation 🚧 |
| z_near | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
from_cols
Creates a 4x4 matrix from four column vectors.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x_axis | DVec4 | No Documentation 🚧 |
| y_axis | DVec4 | No Documentation 🚧 |
| z_axis | DVec4 | No Documentation 🚧 |
| w_axis | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
orthographic_rh_gl
Creates a right-handed orthographic projection matrix with
[-1,1]depth range. This is the same as the OpenGLglOrthofunction in OpenGL. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glOrtho.xml Useful to map a right-handed coordinate system to the normalized device coordinates that OpenGL expects.
Arguments
| Name | Type | Documentation |
|---|---|---|
| left | f64 | No Documentation 🚧 |
| right | f64 | No Documentation 🚧 |
| bottom | f64 | No Documentation 🚧 |
| top | f64 | No Documentation 🚧 |
| near | f64 | No Documentation 🚧 |
| far | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
col
Returns the matrix column for the given
index.Panics
Panics if
indexis greater than 3.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
look_to_rh
Creates a right-handed view matrix using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right,+Y=upand+Z=back.
Arguments
| Name | Type | Documentation |
|---|---|---|
| eye | DVec3 | No Documentation 🚧 |
| dir | DVec3 | No Documentation 🚧 |
| up | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
as_mat4
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
mul_vec4
Transforms a 4D vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
from_rotation_z
Creates an affine transformation matrix containing a 3D rotation around the z axis of
angle(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
to_cols_array
Creates a
[f64; 16]array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f64; 16] | No Documentation 🚧 |
perspective_infinite_reverse_rh
Creates an infinite reverse right-handed perspective projection matrix with
[0,1]depth range. Similar toperspective_infinite_rh, but mapsZ = z_nearto a depth of1andZ = infinityto a depth of0.Panics
Will panic if
z_nearis less than or equal to zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f64 | No Documentation 🚧 |
| aspect_ratio | f64 | No Documentation 🚧 |
| z_near | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
perspective_infinite_rh
Creates an infinite right-handed perspective projection matrix with
[0,1]depth range. Likeperspective_rh, but with an infinite value forz_far. The result is that points nearz_nearare mapped to depth0, and as they move towards infinity the depth approaches1.Panics
Will panic if
z_nearorz_farare less than or equal to zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f64 | No Documentation 🚧 |
| aspect_ratio | f64 | No Documentation 🚧 |
| z_near | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
to_cols_array_2d
Creates a
[[f64; 4]; 4]4D array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [[f64; 4]; 4] | No Documentation 🚧 |
orthographic_rh
Creates a right-handed orthographic projection matrix with
[0,1]depth range. Useful to map a right-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect.
Arguments
| Name | Type | Documentation |
|---|---|---|
| left | f64 | No Documentation 🚧 |
| right | f64 | No Documentation 🚧 |
| bottom | f64 | No Documentation 🚧 |
| top | f64 | No Documentation 🚧 |
| near | f64 | No Documentation 🚧 |
| far | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
DQuat
DQuat
- x:f64
- y:f64
- z:f64
- w:f64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| is_normalized | Returns whether `self` of length `1.0` or not. Uses a precision threshold of `1e-6`. |
| as_quat | No Documentation 🚧 |
| is_near_identity | No Documentation 🚧 |
| angle_between | Returns the angle (in radians) for the minimal rotation for transforming this quaternion into anot... |
| add | Adds two quaternions. The sum is not guaranteed to be normalized. Note that addition is not the s... |
| rotate_towards | Rotates towards `rhs` up to `max_angle` (in radians). When `max_angle` is `0.0`, the result will b... |
| div | Divides a quaternion by a scalar value. The quotient is not guaranteed to be normalized. |
| from_axis_angle | Create a quaternion for a normalized rotation `axis` and `angle` (in radians). The axis must be a ... |
| lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0... |
| from_rotation_arc_2d | Gets the minimal rotation for transforming `from` to `to`. The resulting rotation is around the z... |
| length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
| from_rotation_y | Creates a quaternion from the `angle` (in radians) around the y axis. |
| to_scaled_axis | Returns the rotation axis scaled by the rotation in radians. |
| from_mat3 | Creates a quaternion from a 3x3 rotation matrix. Note if the input matrix contain scales, shears, ... |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| slerp | Performs a spherical linear interpolation between `self` and `end` based on the value `s`. When `s`... |
| from_rotation_arc_colinear | Gets the minimal rotation for transforming `from` to either `to` or `-to`. This means that the re... |
| xyz | Returns the vector part of the quaternion. |
| mul-1 | No Documentation 🚧 |
| from_scaled_axis | Create a quaternion that rotates `v.length()` radians around `v.normalize()`. `from_scaled_axis(Vec3::ZERO)`... |
| length | Computes the length of `self`. |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
| from_vec4 | Creates a new rotation quaternion from a 4D vector. # Preconditions This function does not check ... |
| from_euler | Creates a quaternion from the given Euler rotation sequence and the angles (in radians). |
| is_nan | Returns `true` if any elements are `NAN`. |
| conjugate | Returns the quaternion conjugate of `self`. For a unit quaternion the conjugate is also the invers... |
| sub | Subtracts the `rhs` quaternion from `self`. The difference is not guaranteed to be normalized. |
| from_mat4 | Creates a quaternion from the upper 3x3 rotation matrix inside a homogeneous 4x4 matrix. Note if t... |
| dot | Computes the dot product of `self` and `rhs`. The dot product is equal to the cosine of the angle ... |
| mul_quat | Multiplies two quaternions. If they each represent a rotation, the result will represent the combi... |
| inverse | Returns the inverse of a normalized quaternion. Typically quaternion inverse returns the conjugate... |
| normalize | Returns `self` normalized to length 1.0. For valid results, `self` must _not_ be of length zero. ... |
| to_array | `[x, y, z, w]` |
| clone | No Documentation 🚧 |
| mul_vec3 | Multiplies a quaternion and a 3D vector, returning the rotated vector. # Panics Will panic if `self`... |
| from_rotation_arc | Gets the minimal rotation for transforming `from` to `to`. The rotation is in the plane spanned b... |
| from_affine3 | Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. Note if the input af... |
| from_array | Creates a rotation quaternion from an array. # Preconditions This function does not check if the ... |
| to_euler | Returns the rotation angles for the given euler rotation sequence. |
| from_rotation_x | Creates a quaternion from the `angle` (in radians) around the x axis. |
| length_squared | Computes the squared length of `self`. This is generally faster than `length()` as it avoids a squ... |
| neg | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| mul-2 | No Documentation 🚧 |
| from_rotation_z | Creates a quaternion from the `angle` (in radians) around the z axis. |
| from_xyzw | Creates a new rotation quaternion. This should generally not be called manually unless you know wh... |
| mul | Multiplies two quaternions. If they each represent a rotation, the result will represent the combi... |
is_normalized
Returns whether
selfof length1.0or not. Uses a precision threshold of1e-6.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_quat
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
is_near_identity
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
angle_between
Returns the angle (in radians) for the minimal rotation for transforming this quaternion into another. Both quaternions must be normalized.
Panics
Will panic if
selforrhsare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
add
Adds two quaternions. The sum is not guaranteed to be normalized. Note that addition is not the same as combining the rotations represented by the two quaternions! That corresponds to multiplication.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
rotate_towards
Rotates towards
rhsup tomax_angle(in radians). Whenmax_angleis0.0, the result will be equal toself. Whenmax_angleis equal toself.angle_between(rhs), the result will be equal torhs. Ifmax_angleis negative, rotates towards the exact opposite ofrhs. Will not go past the target. Both quaternions must be normalized.Panics
Will panic if
selforrhsare not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
| rhs | DQuat | No Documentation 🚧 |
| max_angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
div
Divides a quaternion by a scalar value. The quotient is not guaranteed to be normalized.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
from_axis_angle
Create a quaternion for a normalized rotation
axisandangle(in radians). The axis must be a unit vector.Panics
Will panic if
axisis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
lerp
Performs a linear interpolation between
selfandrhsbased on the values. Whensis0.0, the result will be equal toself. Whensis1.0, the result will be equal torhs.Panics
Will panic if
selforendare not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
| end | DQuat | No Documentation 🚧 |
| s | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
from_rotation_arc_2d
Gets the minimal rotation for transforming
fromtoto. The resulting rotation is around the z axis. Will rotate at most 180 degrees. The inputs must be unit vectors.from_rotation_arc_2d(from, to) * from ≈ to. For near-singular cases (from≈to and from≈-to) the current implementation is only accurate to about 0.001 (forf32).Panics
Will panic if
fromortoare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
length_recip
Computes
1.0 / length(). For valid results,selfmust not be of length zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
from_rotation_y
Creates a quaternion from the
angle(in radians) around the y axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
to_scaled_axis
Returns the rotation axis scaled by the rotation in radians.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
from_mat3
Creates a quaternion from a 3x3 rotation matrix. Note if the input matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any input matrix column is not normalized when
glam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mat | DMat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two quaternions contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
| rhs | DQuat | No Documentation 🚧 |
| max_abs_diff | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
slerp
Performs a spherical linear interpolation between
selfandendbased on the values. Whensis0.0, the result will be equal toself. Whensis1.0, the result will be equal toend.Panics
Will panic if
selforendare not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
| end | DQuat | No Documentation 🚧 |
| s | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
from_rotation_arc_colinear
Gets the minimal rotation for transforming
fromto eithertoor-to. This means that the resulting quaternion will rotatefromso that it is colinear withto. The rotation is in the plane spanned by the two vectors. Will rotate at most 90 degrees. The inputs must be unit vectors.to.dot(from_rotation_arc_colinear(from, to) * from).abs() ≈ 1.Panics
Will panic if
fromortoare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
xyz
Returns the vector part of the quaternion.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
from_scaled_axis
Create a quaternion that rotates
v.length()radians aroundv.normalize().from_scaled_axis(Vec3::ZERO)results in the identity quaternion.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
length
Computes the length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_vec4
Creates a new rotation quaternion from a 4D vector.
Preconditions
This function does not check if the input is normalized, it is up to the user to provide normalized input or to normalized the resulting quaternion.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
from_euler
Creates a quaternion from the given Euler rotation sequence and the angles (in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| euler | EulerRot | No Documentation 🚧 |
| a | f64 | No Documentation 🚧 |
| b | f64 | No Documentation 🚧 |
| c | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNAN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
conjugate
Returns the quaternion conjugate of
self. For a unit quaternion the conjugate is also the inverse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
sub
Subtracts the
rhsquaternion fromself. The difference is not guaranteed to be normalized.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
from_mat4
Creates a quaternion from the upper 3x3 rotation matrix inside a homogeneous 4x4 matrix. Note if the upper 3x3 matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any column of the upper 3x3 rotation matrix is not normalized when
glam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mat | DMat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs. The dot product is equal to the cosine of the angle between two quaternion rotations.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
mul_quat
Multiplies two quaternions. If they each represent a rotation, the result will represent the combined rotation. Note that due to floating point rounding the result may not be perfectly normalized.
Panics
Will panic if
selforrhsare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
inverse
Returns the inverse of a normalized quaternion. Typically quaternion inverse returns the conjugate of a normalized quaternion. Because
selfis assumed to already be unit length this method does not normalize before returning the conjugate.Panics
Will panic if
selfis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
normalize
Returns
selfnormalized to length 1.0. For valid results,selfmust not be of length zero. Panics Will panic ifselfis zero length whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f64; 4] | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
mul_vec3
Multiplies a quaternion and a 3D vector, returning the rotated vector.
Panics
Will panic if
selfis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
from_rotation_arc
Gets the minimal rotation for transforming
fromtoto. The rotation is in the plane spanned by the two vectors. Will rotate at most 180 degrees. The inputs must be unit vectors.from_rotation_arc(from, to) * from ≈ to. For near-singular cases (from≈to and from≈-to) the current implementation is only accurate to about 0.001 (forf32).Panics
Will panic if
fromortoare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
from_affine3
Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. Note if the input affine matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any input affine matrix column is not normalized when
glam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | DAffine3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
from_array
Creates a rotation quaternion from an array.
Preconditions
This function does not check if the input is normalized, it is up to the user to provide normalized input or to normalized the resulting quaternion.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [f64; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
to_euler
Returns the rotation angles for the given euler rotation sequence.
Arguments
Returns
from_rotation_x
Creates a quaternion from the
angle(in radians) around the x axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
length_squared
Computes the squared length of
self. This is generally faster thanlength()as it avoids a square root operation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DQuat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
from_rotation_z
Creates a quaternion from the
angle(in radians) around the z axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
from_xyzw
Creates a new rotation quaternion. This should generally not be called manually unless you know what you are doing. Use one of the other constructors instead such as
identityorfrom_axis_angle.from_xyzwis mostly used by unit tests andserdedeserialization.Preconditions
This function does not check if the input is normalized, it is up to the user to provide normalized input or to normalized the resulting quaternion.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | f64 | No Documentation 🚧 |
| y | f64 | No Documentation 🚧 |
| z | f64 | No Documentation 🚧 |
| w | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
mul
Multiplies two quaternions. If they each represent a rotation, the result will represent the combined rotation. Note that due to floating point rounding the result may not be perfectly normalized.
Panics
Will panic if
selforrhsare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
DVec2
DVec2
- x:f64
- y:f64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| as_uvec2 | Casts all elements of `self` to `u32`. |
| round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
| length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
| is_finite_mask | Performs `is_finite` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_finite(), y.is_finite(), ...]... |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
| mul | No Documentation 🚧 |
| as_i16vec2 | Casts all elements of `self` to `i16`. |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
| rotate | Returns `rhs` rotated by the angle of `self`. If `self` is normalized, then this just rotation. Th... |
| rem | No Documentation 🚧 |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| as_i64vec2 | Casts all elements of `self` to `i64`. |
| with_x | Creates a 2D vector from `self` with the given value of `x`. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| mul-1 | No Documentation 🚧 |
| perp | Returns a vector that is equal to `self` rotated by 90 degrees. |
| dot | Computes the dot product of `self` and `rhs`. |
| midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
| fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
| normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
| to_array | `[x, y]` |
| sub-2 | No Documentation 🚧 |
| clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
| refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
| perp_dot | The perpendicular dot product of `self` and `rhs`. Also known as the wedge product, 2D cross produ... |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
| clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
| angle_between | No Documentation 🚧 |
| as_ivec2 | Casts all elements of `self` to `i32`. |
| extend | Creates a 3D vector from `self` and the given `z` value. |
| length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
| project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
| rotate_towards | Rotates towards `rhs` up to `max_angle` (in radians). When `max_angle` is `0.0`, the result will b... |
| recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
| sub | No Documentation 🚧 |
| clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
| rem-1 | No Documentation 🚧 |
| add-1 | No Documentation 🚧 |
| neg | No Documentation 🚧 |
| add-2 | No Documentation 🚧 |
| div-2 | No Documentation 🚧 |
| new | Creates a new vector. |
| rem-2 | No Documentation 🚧 |
| as_u8vec2 | Casts all elements of `self` to `u8`. |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| from_angle | Creates a 2D vector containing `[angle.cos(), angle.sin()]`. This can be used in conjunction with the [`rotate()`]... |
| div | No Documentation 🚧 |
| normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
| lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
| mul-2 | No Documentation 🚧 |
| as_vec2 | Casts all elements of `self` to `f32`. |
| is_nan_mask | Performs `is_nan` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_nan(), y.is_nan(), ...]... |
| add | No Documentation 🚧 |
| from_array | Creates a new vector from an array. |
| is_nan | Returns `true` if any elements are `NaN`. |
| mul_add | Fused multiply-add. Computes `(self * a) + b` element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Using `mul_add` *may* be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| length | Computes the length of `self`. |
| to_angle | Returns the angle (in radians) of this vector in the range `[-π, +π]`. The input does not need to be a unit vector however it must be non-zero. |
| as_i8vec2 | Casts all elements of `self` to `i8`. |
| as_u16vec2 | Casts all elements of `self` to `u16`. |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
| sub-1 | No Documentation 🚧 |
| splat | Creates a vector with all elements set to `v`. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| clone | No Documentation 🚧 |
| trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
| reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| with_y | Creates a 2D vector from `self` with the given value of `y`. |
| project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
| clamp | Component-wise clamping of values, similar to [`f64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| powf | Returns a vector containing each element of `self` raised to the power of `n`. |
| reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
| eq | No Documentation 🚧 |
| is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
| distance | Computes the Euclidean distance between two points in space. |
| is_negative_bitmask | Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. A negat... |
| copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
| as_u64vec2 | Casts all elements of `self` to `u64`. |
| move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
| normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
| div-1 | No Documentation 🚧 |
| exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| angle_to | Returns the angle of rotation (in radians) from `self` to `rhs` in the range `[-π, +π]`. The inputs do not need to be unit vectors however they must be non-zero. |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
as_uvec2
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
round
Returns a vector containing the nearest integer to a number for each element of
self. Round half-way cases away from 0.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self. This is faster thanlength()as it avoids a square root operation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor(). Note that this differs from the Rust implementation offractwhich returnsself - self.trunc(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
is_finite_mask
Performs
is_finiteon each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
| rhs | DVec2 | No Documentation 🚧 |
| max_abs_diff | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
as_i16vec2
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
reject_from
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be of non-zero length.Panics
Will panic if
rhshas a length of zero whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
1.0if the number is positive,+0.0orINFINITY-1.0if the number is negative,-0.0orNEG_INFINITYNANif the number isNAN
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
rotate
Returns
rhsrotated by the angle ofself. Ifselfis normalized, then this just rotation. This is what you usually want. Otherwise, it will be like a rotation with a multiplication byself's length.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
with_x
Creates a 2D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
perp
Returns a vector that is equal to
selfrotated by 90 degrees.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
midpoint
Calculates the midpoint between
selfandrhs. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)should yield the same result asa.lerp(b, 0.5)while being slightly cheaper to compute.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc(). Note that this differs from the GLSL implementation offractwhich returnsself - self.floor(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
normalize_or_zero
Returns
selfnormalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f64; 2] | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
clamp_length_min
Returns a vector with a length no less than
min.Panics
Will panic if
minis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
refract
Returns the refraction direction for a given incident vector
self, surface normalnormaland ratio of indices of refraction,eta. When total internal reflection occurs, a zero vector will be returned.selfandnormalmust be normalized.Panics
Will panic if
selfornormalis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
| normal | DVec2 | No Documentation 🚧 |
| eta | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
perp_dot
The perpendicular dot product of
selfandrhs. Also known as the wedge product, 2D cross product, and determinant.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clamp_length
Returns a vector with a length no less than
minand no more thanmax.Panics
Will panic if
minis greater thanmax, or if eitherminormaxis negative, whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
| min | f64 | No Documentation 🚧 |
| max | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
angle_between
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
as_ivec2
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
extend
Creates a 3D vector from
selfand the givenzvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
length_recip
Computes
1.0 / length(). For valid results,selfmust not be of length zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
project_onto_normalized
Returns the vector projection of
selfontorhs.rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
rotate_towards
Rotates towards
rhsup tomax_angle(in radians). Whenmax_angleis0.0, the result will be equal toself. Whenmax_angleis equal toself.angle_between(rhs), the result will be equal torhs. Ifmax_angleis negative, rotates towards the exact opposite ofrhs. Will not go past the target.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
| rhs | DVec2 | No Documentation 🚧 |
| max_angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/nof each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
clamp_length_max
Returns a vector with a length no more than
max.Panics
Will panic if
maxis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
as_u8vec2
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
from_angle
Creates a 2D vector containing
[angle.cos(), angle.sin()]. This can be used in conjunction with the [rotate()][Self::rotate()] method, e.g.DVec2::from_angle(PI).rotate(DVec2::Y)will create the vector[-1, 0]and rotate [DVec2::Y] around it returning-DVec2::Y.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
normalize
Returns
selfnormalized to length 1.0. For valid results,selfmust be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()] and [Self::normalize_or_zero()]. Panics Will panic if the resulting normalized vector is not finite whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
lerp
Performs a linear interpolation between
selfandrhsbased on the values. Whensis0.0, the result will be equal toself. Whensis1.0, the result will be equal torhs. Whensis outside of range[0, 1], the result is linearly extrapolated.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
| rhs | DVec2 | No Documentation 🚧 |
| s | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
is_nan_mask
Performs
is_nanon each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [f64; 2] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
mul_add
Fused multiply-add. Computes
(self * a) + belement-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_addmay be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
| a | DVec2 | No Documentation 🚧 |
| b | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
length
Computes the length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
to_angle
Returns the angle (in radians) of this vector in the range
[-π, +π]. The input does not need to be a unit vector however it must be non-zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
as_i8vec2
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
as_u16vec2
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs. [Euclidean division]: f64::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec2 | No Documentation 🚧 |
| if_true | DVec2 | No Documentation 🚧 |
| if_false | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self. This means numbers are always truncated towards zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
reject_from_normalized
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
project_onto
Returns the vector projection of
selfontorhs.rhsmust be of non-zero length.Panics
Will panic if
rhsis zero length whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
f64::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
| min | DVec2 | No Documentation 🚧 |
| max | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
powf
Returns a vector containing each element of
selfraised to the power ofn.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
reflect
Returns the reflection vector for a given incident vector
selfand surface normalnormal.normalmust be normalized.Panics
Will panic if
normalis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_normalized
Returns whether
selfis length1.0or not. Uses a precision threshold of approximately1e-4.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhsand the magnitudes ofself.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
move_towards
Moves towards
rhsbased on the valued. Whendis0.0, the result will be equal toself. Whendis equal toself.distance(rhs), the result will be equal torhs. Will not go pastrhs.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
| rhs | DVec2 | No Documentation 🚧 |
| d | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
normalize_or
Returns
selfnormalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
exp
Returns a vector containing
e^self(the exponential function) for each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
angle_to
Returns the angle of rotation (in radians) from
selftorhsin the range[-π, +π]. The inputs do not need to be unit vectors however they must be non-zero.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
DVec3
DVec3
- x:f64
- y:f64
- z:f64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| mul-2 | No Documentation 🚧 |
| move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
| eq | No Documentation 🚧 |
| with_x | Creates a 3D vector from `self` with the given value of `x`. |
| as_ivec3 | Casts all elements of `self` to `i32`. |
| rem-1 | No Documentation 🚧 |
| length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| distance | Computes the Euclidean distance between two points in space. |
| cross | Computes the cross product of `self` and `rhs`. |
| is_nan_mask | Performs `is_nan` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_nan(), y.is_nan(), ...]... |
| floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| sub-2 | No Documentation 🚧 |
| any_orthogonal_vector | Returns some vector that is orthogonal to the given one. The input vector must be finite and non-z... |
| normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
| sub-1 | No Documentation 🚧 |
| ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
| reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| rem-2 | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| mul_add | Fused multiply-add. Computes `(self * a) + b` element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Using `mul_add` *may* be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind. |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| from_array | Creates a new vector from an array. |
| fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
| recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
| splat | Creates a vector with all elements set to `v`. |
| fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
| extend | Creates a 4D vector from `self` and the given `w` value. |
| normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
| mul | No Documentation 🚧 |
| angle_between | Returns the angle (in radians) between two vectors in the range `[0, +π]`. The inputs do not need to be unit vectors however they must be non-zero. |
| new | Creates a new vector. |
| exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
| sub | No Documentation 🚧 |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| add-1 | No Documentation 🚧 |
| normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| as_i64vec3 | Casts all elements of `self` to `i64`. |
| length | Computes the length of `self`. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
| is_finite_mask | Performs `is_finite` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_finite(), y.is_finite(), ...]... |
| as_uvec3 | Casts all elements of `self` to `u32`. |
| reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| with_y | Creates a 3D vector from `self` with the given value of `y`. |
| trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
| any_orthonormal_vector | Returns any unit vector that is orthogonal to the given one. The input vector must be unit length.... |
| div-1 | No Documentation 🚧 |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| as_u8vec3 | Casts all elements of `self` to `u8`. |
| clamp | Component-wise clamping of values, similar to [`f64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| is_negative_bitmask | Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. A negat... |
| signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
| div-2 | No Documentation 🚧 |
| refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
| to_array | `[x, y, z]` |
| midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
| copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
| round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| add-2 | No Documentation 🚧 |
| as_i16vec3 | Casts all elements of `self` to `i16`. |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
| rem | No Documentation 🚧 |
| neg | No Documentation 🚧 |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
| with_z | Creates a 3D vector from `self` with the given value of `z`. |
| as_u16vec3 | Casts all elements of `self` to `u16`. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| powf | Returns a vector containing each element of `self` raised to the power of `n`. |
| as_vec3a | Casts all elements of `self` to `f32`. |
| as_u64vec3 | Casts all elements of `self` to `u64`. |
| as_i8vec3 | Casts all elements of `self` to `i8`. |
| is_nan | Returns `true` if any elements are `NaN`. |
| add | No Documentation 🚧 |
| project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
| length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
| clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
| dot | Computes the dot product of `self` and `rhs`. |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| div | No Documentation 🚧 |
| project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
| clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
| mul-1 | No Documentation 🚧 |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| as_vec3 | Casts all elements of `self` to `f32`. |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
| reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
move_towards
Moves towards
rhsbased on the valued. Whendis0.0, the result will be equal toself. Whendis equal toself.distance(rhs), the result will be equal torhs. Will not go pastrhs.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
| rhs | DVec3 | No Documentation 🚧 |
| d | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
with_x
Creates a 3D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
as_ivec3
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
length_recip
Computes
1.0 / length(). For valid results,selfmust not be of length zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
cross
Computes the cross product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
is_nan_mask
Performs
is_nanon each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
is_normalized
Returns whether
selfis length1.0or not. Uses a precision threshold of approximately1e-4.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
any_orthogonal_vector
Returns some vector that is orthogonal to the given one. The input vector must be finite and non-zero. The output vector is not necessarily unit length. For that use [
Self::any_orthonormal_vector()] instead.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
normalize
Returns
selfnormalized to length 1.0. For valid results,selfmust be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()] and [Self::normalize_or_zero()]. Panics Will panic if the resulting normalized vector is not finite whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
reflect
Returns the reflection vector for a given incident vector
selfand surface normalnormal.normalmust be normalized.Panics
Will panic if
normalis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
mul_add
Fused multiply-add. Computes
(self * a) + belement-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_addmay be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
| a | DVec3 | No Documentation 🚧 |
| b | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [f64; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc(). Note that this differs from the GLSL implementation offractwhich returnsself - self.floor(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/nof each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor(). Note that this differs from the Rust implementation offractwhich returnsself - self.trunc(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
selfand the givenwvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
normalize_or
Returns
selfnormalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
angle_between
Returns the angle (in radians) between two vectors in the range
[0, +π]. The inputs do not need to be unit vectors however they must be non-zero.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
exp
Returns a vector containing
e^self(the exponential function) for each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
normalize_or_zero
Returns
selfnormalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
length
Computes the length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
lerp
Performs a linear interpolation between
selfandrhsbased on the values. Whensis0.0, the result will be equal toself. Whensis1.0, the result will be equal torhs. Whensis outside of range[0, 1], the result is linearly extrapolated.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
| rhs | DVec3 | No Documentation 🚧 |
| s | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
is_finite_mask
Performs
is_finiteon each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
as_uvec3
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
reject_from
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be of non-zero length.Panics
Will panic if
rhshas a length of zero whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self. This means numbers are always truncated towards zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
any_orthonormal_vector
Returns any unit vector that is orthogonal to the given one. The input vector must be unit length.
Panics
Will panic if
selfis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec3 | No Documentation 🚧 |
| if_true | DVec3 | No Documentation 🚧 |
| if_false | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
as_u8vec3
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
f64::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
| min | DVec3 | No Documentation 🚧 |
| max | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
1.0if the number is positive,+0.0orINFINITY-1.0if the number is negative,-0.0orNEG_INFINITYNANif the number isNAN
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
refract
Returns the refraction direction for a given incident vector
self, surface normalnormaland ratio of indices of refraction,eta. When total internal reflection occurs, a zero vector will be returned.selfandnormalmust be normalized.Panics
Will panic if
selfornormalis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
| normal | DVec3 | No Documentation 🚧 |
| eta | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f64; 3] | No Documentation 🚧 |
midpoint
Calculates the midpoint between
selfandrhs. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)should yield the same result asa.lerp(b, 0.5)while being slightly cheaper to compute.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhsand the magnitudes ofself.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
round
Returns a vector containing the nearest integer to a number for each element of
self. Round half-way cases away from 0.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
as_i16vec3
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
clamp_length_max
Returns a vector with a length no more than
max.Panics
Will panic if
maxis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
as_u16vec3
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
powf
Returns a vector containing each element of
selfraised to the power ofn.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
as_u64vec3
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
as_i8vec3
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
project_onto_normalized
Returns the vector projection of
selfontorhs.rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self. This is faster thanlength()as it avoids a square root operation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
clamp_length_min
Returns a vector with a length no less than
min.Panics
Will panic if
minis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
| rhs | DVec3 | No Documentation 🚧 |
| max_abs_diff | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
project_onto
Returns the vector projection of
selfontorhs.rhsmust be of non-zero length.Panics
Will panic if
rhsis zero length whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
clamp_length
Returns a vector with a length no less than
minand no more thanmax.Panics
Will panic if
minis greater thanmax, or if eitherminormaxis negative, whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
| min | f64 | No Documentation 🚧 |
| max | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
as_vec3
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs. [Euclidean division]: f64::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
reject_from_normalized
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
truncate
Creates a 2D vector from the
xandyelements ofself, discardingz. Truncation may also be performed by using [self.xy()][crate::swizzles::Vec3Swizzles::xy()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
DVec4
DVec4
- x:f64
- y:f64
- z:f64
- w:f64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| from_array | Creates a new vector from an array. |
| clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
| as_u8vec4 | Casts all elements of `self` to `u8`. |
| eq | No Documentation 🚧 |
| new | Creates a new vector. |
| dot | Computes the dot product of `self` and `rhs`. |
| to_array | `[x, y, z, w]` |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| add-2 | No Documentation 🚧 |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| div-2 | No Documentation 🚧 |
| signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| sub | No Documentation 🚧 |
| as_i8vec4 | Casts all elements of `self` to `i8`. |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
| truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`DVec3`]... |
| add | No Documentation 🚧 |
| rem-1 | No Documentation 🚧 |
| as_i64vec4 | Casts all elements of `self` to `i64`. |
| recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
| trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
| sub-1 | No Documentation 🚧 |
| mul-2 | No Documentation 🚧 |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| splat | Creates a vector with all elements set to `v`. |
| mul_add | Fused multiply-add. Computes `(self * a) + b` element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Using `mul_add` *may* be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind. |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| is_nan_mask | Performs `is_nan` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_nan(), y.is_nan(), ...]... |
| ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
| mul-1 | No Documentation 🚧 |
| is_nan | Returns `true` if any elements are `NaN`. |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
| midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
| is_negative_bitmask | Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. A negat... |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
| clamp | Component-wise clamping of values, similar to [`f64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
| project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
| reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| with_z | Creates a 4D vector from `self` with the given value of `z`. |
| normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
| length | Computes the length of `self`. |
| powf | Returns a vector containing each element of `self` raised to the power of `n`. |
| clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
| rem | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| as_u16vec4 | Casts all elements of `self` to `u16`. |
| distance | Computes the Euclidean distance between two points in space. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
| as_uvec4 | Casts all elements of `self` to `u32`. |
| exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
| clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
| with_x | Creates a 4D vector from `self` with the given value of `x`. |
| length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
| reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
| move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
| is_finite_mask | Performs `is_finite` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_finite(), y.is_finite(), ...]... |
| with_w | Creates a 4D vector from `self` with the given value of `w`. |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
| add-1 | No Documentation 🚧 |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| as_vec4 | Casts all elements of `self` to `f32`. |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| div-1 | No Documentation 🚧 |
| as_i16vec4 | Casts all elements of `self` to `i16`. |
| sub-2 | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
| is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
| rem-2 | No Documentation 🚧 |
| as_ivec4 | Casts all elements of `self` to `i32`. |
| as_u64vec4 | Casts all elements of `self` to `u64`. |
| normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| with_y | Creates a 4D vector from `self` with the given value of `y`. |
| lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
| floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
| fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
| div | No Documentation 🚧 |
| neg | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [f64; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
clamp_length_max
Returns a vector with a length no more than
max.Panics
Will panic if
maxis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
as_u8vec4
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Creates a new vector.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | f64 | No Documentation 🚧 |
| y | f64 | No Documentation 🚧 |
| z | f64 | No Documentation 🚧 |
| w | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f64; 4] | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
1.0if the number is positive,+0.0orINFINITY-1.0if the number is negative,-0.0orNEG_INFINITYNANif the number isNAN
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
as_i8vec4
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhsand the magnitudes ofself.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
truncate
Creates a 3D vector from the
x,yandzelements ofself, discardingw. Truncation to [DVec3] may also be performed by using [self.xyz()][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
as_i64vec4
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/nof each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self. This means numbers are always truncated towards zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
| rhs | DVec4 | No Documentation 🚧 |
| max_abs_diff | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
mul_add
Fused multiply-add. Computes
(self * a) + belement-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_addmay be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
| a | DVec4 | No Documentation 🚧 |
| b | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
is_nan_mask
Performs
is_nanon each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
midpoint
Calculates the midpoint between
selfandrhs. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)should yield the same result asa.lerp(b, 0.5)while being slightly cheaper to compute.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
round
Returns a vector containing the nearest integer to a number for each element of
self. Round half-way cases away from 0.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
f64::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
| min | DVec4 | No Documentation 🚧 |
| max | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc(). Note that this differs from the GLSL implementation offractwhich returnsself - self.floor(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
project_onto_normalized
Returns the vector projection of
selfontorhs.rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
reject_from
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be of non-zero length.Panics
Will panic if
rhshas a length of zero whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
refract
Returns the refraction direction for a given incident vector
self, surface normalnormaland ratio of indices of refraction,eta. When total internal reflection occurs, a zero vector will be returned.selfandnormalmust be normalized.Panics
Will panic if
selfornormalis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
| normal | DVec4 | No Documentation 🚧 |
| eta | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
with_z
Creates a 4D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
normalize
Returns
selfnormalized to length 1.0. For valid results,selfmust be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()] and [Self::normalize_or_zero()]. Panics Will panic if the resulting normalized vector is not finite whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
length
Computes the length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
powf
Returns a vector containing each element of
selfraised to the power ofn.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
clamp_length
Returns a vector with a length no less than
minand no more thanmax.Panics
Will panic if
minis greater thanmax, or if eitherminormaxis negative, whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
| min | f64 | No Documentation 🚧 |
| max | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
as_u16vec4
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
normalize_or
Returns
selfnormalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
as_uvec4
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
exp
Returns a vector containing
e^self(the exponential function) for each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
clamp_length_min
Returns a vector with a length no less than
min.Panics
Will panic if
minis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
length_recip
Computes
1.0 / length(). For valid results,selfmust not be of length zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
reflect
Returns the reflection vector for a given incident vector
selfand surface normalnormal.normalmust be normalized.Panics
Will panic if
normalis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
move_towards
Moves towards
rhsbased on the valued. Whendis0.0, the result will be equal toself. Whendis equal toself.distance(rhs), the result will be equal torhs. Will not go pastrhs.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
| rhs | DVec4 | No Documentation 🚧 |
| d | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
is_finite_mask
Performs
is_finiteon each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
selfwith the given value ofw.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs. [Euclidean division]: f64::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
as_vec4
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec4 | No Documentation 🚧 |
| if_true | DVec4 | No Documentation 🚧 |
| if_false | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
as_i16vec4
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self. This is faster thanlength()as it avoids a square root operation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
is_normalized
Returns whether
selfis length1.0or not. Uses a precision threshold of approximately1e-4.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f64 | No Documentation 🚧 |
project_onto
Returns the vector projection of
selfontorhs.rhsmust be of non-zero length.Panics
Will panic if
rhsis zero length whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
as_u64vec4
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
normalize_or_zero
Returns
selfnormalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
reject_from_normalized
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
lerp
Performs a linear interpolation between
selfandrhsbased on the values. Whensis0.0, the result will be equal toself. Whensis1.0, the result will be equal torhs. Whensis outside of range[0, 1], the result is linearly extrapolated.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
| rhs | DVec4 | No Documentation 🚧 |
| s | f64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor(). Note that this differs from the Rust implementation offractwhich returnsself - self.trunc(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | DVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
EulerRot
ZYX
ZXY
YXZ
YZX
XYZ
XZY
ZYZ
ZXZ
YXY
YZY
XYX
XZX
ZYXEx
ZXYEx
YXZEx
YZXEx
XYZEx
XZYEx
ZYZEx
ZXZEx
YXYEx
YZYEx
XYXEx
XZXEx
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| eq | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | EulerRot | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | EulerRot | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | EulerRot | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
I16Vec2
I16Vec2
- x:i16
- y:i16
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| as_uvec2 | Casts all elements of `self` to `u32`. |
| perp_dot | The perpendicular dot product of `self` and `rhs`. Also known as the wedge product, 2D cross produ... |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| with_y | Creates a 2D vector from `self` with the given value of `y`. |
| new | Creates a new vector. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| is_negative_bitmask | Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. A negat... |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| mul-2 | No Documentation 🚧 |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| rem-1 | No Documentation 🚧 |
| sub-1 | No Documentation 🚧 |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| as_vec2 | Casts all elements of `self` to `f32`. |
| clone | No Documentation 🚧 |
| div-1 | No Documentation 🚧 |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| mul-1 | No Documentation 🚧 |
| from_array | Creates a new vector from an array. |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| sub-2 | No Documentation 🚧 |
| as_i8vec2 | Casts all elements of `self` to `i8`. |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
| mul | No Documentation 🚧 |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| perp | Returns a vector that is equal to `self` rotated by 90 degrees. |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| dot | Computes the dot product of `self` and `rhs`. |
| as_i64vec2 | Casts all elements of `self` to `i64`. |
| div | No Documentation 🚧 |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| add-1 | No Documentation 🚧 |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| add | No Documentation 🚧 |
| clamp | Component-wise clamping of values, similar to [`i16::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| extend | Creates a 3D vector from `self` and the given `z` value. |
| with_x | Creates a 2D vector from `self` with the given value of `x`. |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| div-2 | No Documentation 🚧 |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
| splat | Creates a vector with all elements set to `v`. |
| rotate | Returns `rhs` rotated by the angle of `self`. If `self` is normalized, then this just rotation. Th... |
| length_squared | Computes the squared length of `self`. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| rem | No Documentation 🚧 |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| add-2 | No Documentation 🚧 |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| as_dvec2 | Casts all elements of `self` to `f64`. |
| neg | No Documentation 🚧 |
| sub | No Documentation 🚧 |
| as_u8vec2 | Casts all elements of `self` to `u8`. |
| rem-2 | No Documentation 🚧 |
| as_u16vec2 | Casts all elements of `self` to `u16`. |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
| eq | No Documentation 🚧 |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
| to_array | `[x, y]` |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| as_u64vec2 | Casts all elements of `self` to `u64`. |
| as_ivec2 | Casts all elements of `self` to `i32`. |
| saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
as_uvec2
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
perp_dot
The perpendicular dot product of
selfandrhs. Also known as the wedge product, 2D cross product, and determinant.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [i16; 2] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
as_i8vec2
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
0if the number is zero1if the number is positive-1if the number is negative
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
perp
Returns a vector that is equal to
selfrotated by 90 degrees.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
i16::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
| min | I16Vec2 | No Documentation 🚧 |
| max | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
extend
Creates a 3D vector from
selfand the givenzvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
with_x
Creates a 2D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow. [Euclidean division]: i16::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
rotate
Returns
rhsrotated by the angle ofself. Ifselfis normalized, then this just rotation. This is what you usually want. Otherwise, it will be like a rotation with a multiplication byself's length.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec2 | No Documentation 🚧 |
| if_true | I16Vec2 | No Documentation 🚧 |
| if_false | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
as_dvec2
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
as_u8vec2
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
as_u16vec2
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [i16; 2] | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
as_ivec2
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
I16Vec3
I16Vec3
- x:i16
- y:i16
- z:i16
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| as_i64vec3 | Casts all elements of `self` to `i64`. |
| splat | Creates a vector with all elements set to `v`. |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| add | No Documentation 🚧 |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| cross | Computes the cross product of `self` and `rhs`. |
| with_x | Creates a 3D vector from `self` with the given value of `x`. |
| saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
| dot | Computes the dot product of `self` and `rhs`. |
| from_array | Creates a new vector from an array. |
| with_z | Creates a 3D vector from `self` with the given value of `z`. |
| as_uvec3 | Casts all elements of `self` to `u32`. |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| rem-1 | No Documentation 🚧 |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| div-1 | No Documentation 🚧 |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
| clamp | Component-wise clamping of values, similar to [`i16::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| clone | No Documentation 🚧 |
| sub | No Documentation 🚧 |
| saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
| mul-1 | No Documentation 🚧 |
| new | Creates a new vector. |
| with_y | Creates a 3D vector from `self` with the given value of `y`. |
| extend | Creates a 4D vector from `self` and the given `w` value. |
| truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| as_ivec3 | Casts all elements of `self` to `i32`. |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| div | No Documentation 🚧 |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| as_vec3 | Casts all elements of `self` to `f32`. |
| as_dvec3 | Casts all elements of `self` to `f64`. |
| sub-2 | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| is_negative_bitmask | Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. A negat... |
| rem-2 | No Documentation 🚧 |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| as_u8vec3 | Casts all elements of `self` to `u8`. |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| rem | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| mul-2 | No Documentation 🚧 |
| as_u16vec3 | Casts all elements of `self` to `u16`. |
| add-1 | No Documentation 🚧 |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| neg | No Documentation 🚧 |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| as_u64vec3 | Casts all elements of `self` to `u64`. |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
| eq | No Documentation 🚧 |
| div-2 | No Documentation 🚧 |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| as_i8vec3 | Casts all elements of `self` to `i8`. |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
| length_squared | Computes the squared length of `self`. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| add-2 | No Documentation 🚧 |
| as_vec3a | Casts all elements of `self` to `f32`. |
| to_array | `[x, y, z]` |
| sub-1 | No Documentation 🚧 |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
cross
Computes the cross product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [i16; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
as_uvec3
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
0if the number is zero1if the number is positive-1if the number is negative
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
i16::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
| min | I16Vec3 | No Documentation 🚧 |
| max | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
selfand the givenwvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
truncate
Creates a 2D vector from the
xandyelements ofself, discardingz. Truncation may also be performed by using [self.xy()][crate::swizzles::Vec3Swizzles::xy()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
as_ivec3
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec3 | No Documentation 🚧 |
| if_true | I16Vec3 | No Documentation 🚧 |
| if_false | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
as_vec3
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
as_u8vec3
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
as_u16vec3
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
as_u64vec3
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
as_i8vec3
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow. [Euclidean division]: i16::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [i16; 3] | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
I16Vec4
I16Vec4
- x:i16
- y:i16
- z:i16
- w:i16
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| as_i64vec4 | Casts all elements of `self` to `i64`. |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| mul-2 | No Documentation 🚧 |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| mul | No Documentation 🚧 |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| div-1 | No Documentation 🚧 |
| wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
| with_y | Creates a 4D vector from `self` with the given value of `y`. |
| mul-1 | No Documentation 🚧 |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| as_dvec4 | Casts all elements of `self` to `f64`. |
| signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| is_negative_bitmask | Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. A negat... |
| rem-2 | No Documentation 🚧 |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| eq | No Documentation 🚧 |
| as_vec4 | Casts all elements of `self` to `f32`. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| sub | No Documentation 🚧 |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| length_squared | Computes the squared length of `self`. |
| truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`I16Vec3`]... |
| saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
| div-2 | No Documentation 🚧 |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| as_uvec4 | Casts all elements of `self` to `u32`. |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| add | No Documentation 🚧 |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| rem-1 | No Documentation 🚧 |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| as_u16vec4 | Casts all elements of `self` to `u16`. |
| div | No Documentation 🚧 |
| sub-1 | No Documentation 🚧 |
| with_z | Creates a 4D vector from `self` with the given value of `z`. |
| clone | No Documentation 🚧 |
| as_u64vec4 | Casts all elements of `self` to `u64`. |
| from_array | Creates a new vector from an array. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| to_array | `[x, y, z, w]` |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
| dot | Computes the dot product of `self` and `rhs`. |
| splat | Creates a vector with all elements set to `v`. |
| neg | No Documentation 🚧 |
| sub-2 | No Documentation 🚧 |
| as_u8vec4 | Casts all elements of `self` to `u8`. |
| as_ivec4 | Casts all elements of `self` to `i32`. |
| add-2 | No Documentation 🚧 |
| rem | No Documentation 🚧 |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
| with_w | Creates a 4D vector from `self` with the given value of `w`. |
| new | Creates a new vector. |
| add-1 | No Documentation 🚧 |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| clamp | Component-wise clamping of values, similar to [`i16::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| as_i8vec4 | Casts all elements of `self` to `i8`. |
| with_x | Creates a 4D vector from `self` with the given value of `x`. |
| saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
as_i64vec4
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
as_dvec4
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
0if the number is zero1if the number is positive-1if the number is negative
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_vec4
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
truncate
Creates a 3D vector from the
x,yandzelements ofself, discardingw. Truncation to [I16Vec3] may also be performed by using [self.xyz()][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
as_uvec4
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
as_u16vec4
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
with_z
Creates a 4D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
as_u64vec4
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [i16; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec4 | No Documentation 🚧 |
| if_true | I16Vec4 | No Documentation 🚧 |
| if_false | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [i16; 4] | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow. [Euclidean division]: i16::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i16 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
as_u8vec4
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
selfwith the given value ofw.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | i16 | No Documentation 🚧 |
| y | i16 | No Documentation 🚧 |
| z | i16 | No Documentation 🚧 |
| w | i16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
i16::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
| min | I16Vec4 | No Documentation 🚧 |
| max | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
as_i8vec4
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
I64Vec2
I64Vec2
- x:i64
- y:i64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| as_dvec2 | Casts all elements of `self` to `f64`. |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| div-2 | No Documentation 🚧 |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
| add | No Documentation 🚧 |
| dot | Computes the dot product of `self` and `rhs`. |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| sub | No Documentation 🚧 |
| as_u64vec2 | Casts all elements of `self` to `u64`. |
| with_y | Creates a 2D vector from `self` with the given value of `y`. |
| as_vec2 | Casts all elements of `self` to `f32`. |
| as_i8vec2 | Casts all elements of `self` to `i8`. |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| perp | Returns a vector that is equal to `self` rotated by 90 degrees. |
| signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
| extend | Creates a 3D vector from `self` and the given `z` value. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| div | No Documentation 🚧 |
| rotate | Returns `rhs` rotated by the angle of `self`. If `self` is normalized, then this just rotation. Th... |
| mul | No Documentation 🚧 |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| div-1 | No Documentation 🚧 |
| as_u16vec2 | Casts all elements of `self` to `u16`. |
| saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
| add-1 | No Documentation 🚧 |
| as_i16vec2 | Casts all elements of `self` to `i16`. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| rem | No Documentation 🚧 |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| is_negative_bitmask | Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. A negat... |
| sub-1 | No Documentation 🚧 |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| as_ivec2 | Casts all elements of `self` to `i32`. |
| rem-2 | No Documentation 🚧 |
| perp_dot | The perpendicular dot product of `self` and `rhs`. Also known as the wedge product, 2D cross produ... |
| clone | No Documentation 🚧 |
| with_x | Creates a 2D vector from `self` with the given value of `x`. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| mul-1 | No Documentation 🚧 |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| mul-2 | No Documentation 🚧 |
| neg | No Documentation 🚧 |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| splat | Creates a vector with all elements set to `v`. |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| from_array | Creates a new vector from an array. |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| as_u8vec2 | Casts all elements of `self` to `u8`. |
| clamp | Component-wise clamping of values, similar to [`i64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| eq | No Documentation 🚧 |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
| length_squared | Computes the squared length of `self`. |
| new | Creates a new vector. |
| rem-1 | No Documentation 🚧 |
| sub-2 | No Documentation 🚧 |
| as_uvec2 | Casts all elements of `self` to `u32`. |
| to_array | `[x, y]` |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| add-2 | No Documentation 🚧 |
as_dvec2
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
as_i8vec2
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
perp
Returns a vector that is equal to
selfrotated by 90 degrees.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
0if the number is zero1if the number is positive-1if the number is negative
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
extend
Creates a 3D vector from
selfand the givenzvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
rotate
Returns
rhsrotated by the angle ofself. Ifselfis normalized, then this just rotation. This is what you usually want. Otherwise, it will be like a rotation with a multiplication byself's length.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
as_u16vec2
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
as_i16vec2
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec2 | No Documentation 🚧 |
| if_true | I64Vec2 | No Documentation 🚧 |
| if_false | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
as_ivec2
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
perp_dot
The perpendicular dot product of
selfandrhs. Also known as the wedge product, 2D cross product, and determinant.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
with_x
Creates a 2D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow. [Euclidean division]: i64::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [i64; 2] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
as_u8vec2
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
i64::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
| min | I64Vec2 | No Documentation 🚧 |
| max | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
as_uvec2
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [i64; 2] | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
I64Vec3
I64Vec3
- x:i64
- y:i64
- z:i64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| sub | No Documentation 🚧 |
| mul-1 | No Documentation 🚧 |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| rem-1 | No Documentation 🚧 |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| extend | Creates a 4D vector from `self` and the given `w` value. |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
| signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
| sub-1 | No Documentation 🚧 |
| add-2 | No Documentation 🚧 |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| cross | Computes the cross product of `self` and `rhs`. |
| saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
| rem | No Documentation 🚧 |
| new | Creates a new vector. |
| as_u8vec3 | Casts all elements of `self` to `u8`. |
| mul-2 | No Documentation 🚧 |
| as_dvec3 | Casts all elements of `self` to `f64`. |
| truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
| sub-2 | No Documentation 🚧 |
| wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| add | No Documentation 🚧 |
| dot | Computes the dot product of `self` and `rhs`. |
| with_z | Creates a 3D vector from `self` with the given value of `z`. |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
| length_squared | Computes the squared length of `self`. |
| add-1 | No Documentation 🚧 |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| as_vec3a | Casts all elements of `self` to `f32`. |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| as_vec3 | Casts all elements of `self` to `f32`. |
| eq | No Documentation 🚧 |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| mul | No Documentation 🚧 |
| neg | No Documentation 🚧 |
| with_x | Creates a 3D vector from `self` with the given value of `x`. |
| div-2 | No Documentation 🚧 |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| rem-2 | No Documentation 🚧 |
| as_u16vec3 | Casts all elements of `self` to `u16`. |
| as_ivec3 | Casts all elements of `self` to `i32`. |
| as_u64vec3 | Casts all elements of `self` to `u64`. |
| clone | No Documentation 🚧 |
| as_uvec3 | Casts all elements of `self` to `u32`. |
| is_negative_bitmask | Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. A negat... |
| as_i16vec3 | Casts all elements of `self` to `i16`. |
| with_y | Creates a 3D vector from `self` with the given value of `y`. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| to_array | `[x, y, z]` |
| splat | Creates a vector with all elements set to `v`. |
| div-1 | No Documentation 🚧 |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| as_i8vec3 | Casts all elements of `self` to `i8`. |
| from_array | Creates a new vector from an array. |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| clamp | Component-wise clamping of values, similar to [`i64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| div | No Documentation 🚧 |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| assert_receiver_is_total_eq | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
selfand the givenwvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow. [Euclidean division]: i64::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
0if the number is zero1if the number is positive-1if the number is negative
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
cross
Computes the cross product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
as_u8vec3
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
truncate
Creates a 2D vector from the
xandyelements ofself, discardingz. Truncation may also be performed by using [self.xy()][crate::swizzles::Vec3Swizzles::xy()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
with_z
Creates a 3D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
as_vec3
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
as_u16vec3
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
as_ivec3
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
as_u64vec3
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
as_uvec3
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
as_i16vec3
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec3 | No Documentation 🚧 |
| if_true | I64Vec3 | No Documentation 🚧 |
| if_false | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [i64; 3] | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
as_i8vec3
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [i64; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
i64::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
| min | I64Vec3 | No Documentation 🚧 |
| max | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
I64Vec4
I64Vec4
- x:i64
- y:i64
- z:i64
- w:i64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| as_vec4 | Casts all elements of `self` to `f32`. |
| div-1 | No Documentation 🚧 |
| wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
| as_dvec4 | Casts all elements of `self` to `f64`. |
| splat | Creates a vector with all elements set to `v`. |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`I64Vec3`]... |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| mul-2 | No Documentation 🚧 |
| with_z | Creates a 4D vector from `self` with the given value of `z`. |
| as_i8vec4 | Casts all elements of `self` to `i8`. |
| with_w | Creates a 4D vector from `self` with the given value of `w`. |
| as_i16vec4 | Casts all elements of `self` to `i16`. |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| mul | No Documentation 🚧 |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| rem | No Documentation 🚧 |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
| add-2 | No Documentation 🚧 |
| saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
| length_squared | Computes the squared length of `self`. |
| rem-2 | No Documentation 🚧 |
| div | No Documentation 🚧 |
| neg | No Documentation 🚧 |
| with_x | Creates a 4D vector from `self` with the given value of `x`. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| sub | No Documentation 🚧 |
| div-2 | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| as_u8vec4 | Casts all elements of `self` to `u8`. |
| sub-1 | No Documentation 🚧 |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| clone | No Documentation 🚧 |
| add-1 | No Documentation 🚧 |
| new | Creates a new vector. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| mul-1 | No Documentation 🚧 |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
| with_y | Creates a 4D vector from `self` with the given value of `y`. |
| wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| as_u16vec4 | Casts all elements of `self` to `u16`. |
| as_u64vec4 | Casts all elements of `self` to `u64`. |
| clamp | Component-wise clamping of values, similar to [`i64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| rem-1 | No Documentation 🚧 |
| saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| as_uvec4 | Casts all elements of `self` to `u32`. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| sub-2 | No Documentation 🚧 |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| is_negative_bitmask | Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. A negat... |
| from_array | Creates a new vector from an array. |
| as_ivec4 | Casts all elements of `self` to `i32`. |
| add | No Documentation 🚧 |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| to_array | `[x, y, z, w]` |
| dot | Computes the dot product of `self` and `rhs`. |
as_vec4
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
as_dvec4
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
truncate
Creates a 3D vector from the
x,yandzelements ofself, discardingw. Truncation to [I64Vec3] may also be performed by using [self.xyz()][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
with_z
Creates a 4D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
as_i8vec4
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
selfwith the given value ofw.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
as_i16vec4
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
0if the number is zero1if the number is positive-1if the number is negative
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow. [Euclidean division]: i64::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_u8vec4
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | i64 | No Documentation 🚧 |
| y | i64 | No Documentation 🚧 |
| z | i64 | No Documentation 🚧 |
| w | i64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
as_u16vec4
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
as_u64vec4
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
i64::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
| min | I64Vec4 | No Documentation 🚧 |
| max | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
as_uvec4
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [i64; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec4 | No Documentation 🚧 |
| if_true | I64Vec4 | No Documentation 🚧 |
| if_false | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [i64; 4] | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i64 | No Documentation 🚧 |
I8Vec2
I8Vec2
- x:i8
- y:i8
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| with_x | Creates a 2D vector from `self` with the given value of `x`. |
| length_squared | Computes the squared length of `self`. |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| rem-2 | No Documentation 🚧 |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| add | No Documentation 🚧 |
| neg | No Documentation 🚧 |
| saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
| mul | No Documentation 🚧 |
| rem-1 | No Documentation 🚧 |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| from_array | Creates a new vector from an array. |
| as_ivec2 | Casts all elements of `self` to `i32`. |
| eq | No Documentation 🚧 |
| new | Creates a new vector. |
| with_y | Creates a 2D vector from `self` with the given value of `y`. |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| as_u16vec2 | Casts all elements of `self` to `u16`. |
| dot | Computes the dot product of `self` and `rhs`. |
| saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| as_uvec2 | Casts all elements of `self` to `u32`. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| as_vec2 | Casts all elements of `self` to `f32`. |
| as_dvec2 | Casts all elements of `self` to `f64`. |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| add-2 | No Documentation 🚧 |
| rem | No Documentation 🚧 |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| perp | Returns a vector that is equal to `self` rotated by 90 degrees. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
| to_array | `[x, y]` |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| sub-2 | No Documentation 🚧 |
| extend | Creates a 3D vector from `self` and the given `z` value. |
| rotate | Returns `rhs` rotated by the angle of `self`. If `self` is normalized, then this just rotation. Th... |
| wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| is_negative_bitmask | Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. A negat... |
| splat | Creates a vector with all elements set to `v`. |
| div-2 | No Documentation 🚧 |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
| as_u64vec2 | Casts all elements of `self` to `u64`. |
| mul-1 | No Documentation 🚧 |
| div-1 | No Documentation 🚧 |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| as_u8vec2 | Casts all elements of `self` to `u8`. |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| as_i64vec2 | Casts all elements of `self` to `i64`. |
| sub | No Documentation 🚧 |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| div | No Documentation 🚧 |
| add-1 | No Documentation 🚧 |
| perp_dot | The perpendicular dot product of `self` and `rhs`. Also known as the wedge product, 2D cross produ... |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| clamp | Component-wise clamping of values, similar to [`i8::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| as_i16vec2 | Casts all elements of `self` to `i16`. |
| mul-2 | No Documentation 🚧 |
| sub-1 | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
with_x
Creates a 2D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec2 | No Documentation 🚧 |
| if_true | I8Vec2 | No Documentation 🚧 |
| if_false | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [i8; 2] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
as_ivec2
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
as_u16vec2
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
as_uvec2
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
as_dvec2
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
perp
Returns a vector that is equal to
selfrotated by 90 degrees.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow. [Euclidean division]: i8::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [i8; 2] | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
extend
Creates a 3D vector from
selfand the givenzvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
rotate
Returns
rhsrotated by the angle ofself. Ifselfis normalized, then this just rotation. This is what you usually want. Otherwise, it will be like a rotation with a multiplication byself's length.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i8 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
0if the number is zero1if the number is positive-1if the number is negative
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
as_u8vec2
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
perp_dot
The perpendicular dot product of
selfandrhs. Also known as the wedge product, 2D cross product, and determinant.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
i8::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
| min | I8Vec2 | No Documentation 🚧 |
| max | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
as_i16vec2
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
I8Vec3
I8Vec3
- x:i8
- y:i8
- z:i8
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates a new vector. |
| mul-1 | No Documentation 🚧 |
| div-2 | No Documentation 🚧 |
| extend | Creates a 4D vector from `self` and the given `w` value. |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| splat | Creates a vector with all elements set to `v`. |
| sub | No Documentation 🚧 |
| wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| as_vec3 | Casts all elements of `self` to `f32`. |
| as_u64vec3 | Casts all elements of `self` to `u64`. |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| add-2 | No Documentation 🚧 |
| signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| clone | No Documentation 🚧 |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| as_i16vec3 | Casts all elements of `self` to `i16`. |
| as_u16vec3 | Casts all elements of `self` to `u16`. |
| rem | No Documentation 🚧 |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| add | No Documentation 🚧 |
| rem-2 | No Documentation 🚧 |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| clamp | Component-wise clamping of values, similar to [`i8::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| with_y | Creates a 3D vector from `self` with the given value of `y`. |
| from_array | Creates a new vector from an array. |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| length_squared | Computes the squared length of `self`. |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| mul-2 | No Documentation 🚧 |
| div-1 | No Documentation 🚧 |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| rem-1 | No Documentation 🚧 |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
| as_u8vec3 | Casts all elements of `self` to `u8`. |
| truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
| saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| mul | No Documentation 🚧 |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| dot | Computes the dot product of `self` and `rhs`. |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| with_z | Creates a 3D vector from `self` with the given value of `z`. |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| to_array | `[x, y, z]` |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| as_uvec3 | Casts all elements of `self` to `u32`. |
| add-1 | No Documentation 🚧 |
| is_negative_bitmask | Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. A negat... |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| neg | No Documentation 🚧 |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| as_ivec3 | Casts all elements of `self` to `i32`. |
| saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
| sub-2 | No Documentation 🚧 |
| as_vec3a | Casts all elements of `self` to `f32`. |
| wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| as_i64vec3 | Casts all elements of `self` to `i64`. |
| as_dvec3 | Casts all elements of `self` to `f64`. |
| sub-1 | No Documentation 🚧 |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| cross | Computes the cross product of `self` and `rhs`. |
| with_x | Creates a 3D vector from `self` with the given value of `x`. |
| eq | No Documentation 🚧 |
| div | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
selfand the givenwvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i8 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
as_vec3
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
as_u64vec3
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
0if the number is zero1if the number is positive-1if the number is negative
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec3 | No Documentation 🚧 |
| if_true | I8Vec3 | No Documentation 🚧 |
| if_false | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
as_i16vec3
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
as_u16vec3
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow. [Euclidean division]: i8::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
i8::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
| min | I8Vec3 | No Documentation 🚧 |
| max | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [i8; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
as_u8vec3
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
truncate
Creates a 2D vector from the
xandyelements ofself, discardingz. Truncation may also be performed by using [self.xy()][crate::swizzles::Vec3Swizzles::xy()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [i8; 3] | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
as_uvec3
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
as_ivec3
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
cross
Computes the cross product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
I8Vec4
I8Vec4
- x:i8
- y:i8
- z:i8
- w:i8
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| as_i64vec4 | Casts all elements of `self` to `i64`. |
| sub-1 | No Documentation 🚧 |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| rem-1 | No Documentation 🚧 |
| add-2 | No Documentation 🚧 |
| with_y | Creates a 4D vector from `self` with the given value of `y`. |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| div | No Documentation 🚧 |
| wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
| splat | Creates a vector with all elements set to `v`. |
| as_u16vec4 | Casts all elements of `self` to `u16`. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| mul-1 | No Documentation 🚧 |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
| with_x | Creates a 4D vector from `self` with the given value of `x`. |
| eq | No Documentation 🚧 |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
| as_i16vec4 | Casts all elements of `self` to `i16`. |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| neg | No Documentation 🚧 |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| as_uvec4 | Casts all elements of `self` to `u32`. |
| sub-2 | No Documentation 🚧 |
| rem | No Documentation 🚧 |
| mul-2 | No Documentation 🚧 |
| from_array | Creates a new vector from an array. |
| signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`I8Vec3`]... |
| as_u64vec4 | Casts all elements of `self` to `u64`. |
| as_ivec4 | Casts all elements of `self` to `i32`. |
| length_squared | Computes the squared length of `self`. |
| is_negative_bitmask | Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. A negat... |
| sub | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| with_w | Creates a 4D vector from `self` with the given value of `w`. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| add | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| as_vec4 | Casts all elements of `self` to `f32`. |
| div-2 | No Documentation 🚧 |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| as_dvec4 | Casts all elements of `self` to `f64`. |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| clamp | Component-wise clamping of values, similar to [`i8::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| add-1 | No Documentation 🚧 |
| with_z | Creates a 4D vector from `self` with the given value of `z`. |
| div-1 | No Documentation 🚧 |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
| to_array | `[x, y, z, w]` |
| new | Creates a new vector. |
| as_u8vec4 | Casts all elements of `self` to `u8`. |
| rem-2 | No Documentation 🚧 |
| dot | Computes the dot product of `self` and `rhs`. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
as_i64vec4
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i8 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
as_u16vec4
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec4 | No Documentation 🚧 |
| if_true | I8Vec4 | No Documentation 🚧 |
| if_false | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow. [Euclidean division]: i8::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
as_i16vec4
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
as_uvec4
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [i8; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
0if the number is zero1if the number is positive-1if the number is negative
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
truncate
Creates a 3D vector from the
x,yandzelements ofself, discardingw. Truncation to [I8Vec3] may also be performed by using [self.xyz()][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
as_u64vec4
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
selfwith the given value ofw.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
as_vec4
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
as_dvec4
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
i8::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
| min | I8Vec4 | No Documentation 🚧 |
| max | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
with_z
Creates a 4D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [i8; 4] | No Documentation 🚧 |
new
Creates a new vector.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | i8 | No Documentation 🚧 |
| y | i8 | No Documentation 🚧 |
| z | i8 | No Documentation 🚧 |
| w | i8 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
as_u8vec4
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | I8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i8 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
IVec2
IVec2
- x:i32
- y:i32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| as_u16vec2 | Casts all elements of `self` to `u16`. |
| div | No Documentation 🚧 |
| sub | No Documentation 🚧 |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
| perp_dot | The perpendicular dot product of `self` and `rhs`. Also known as the wedge product, 2D cross produ... |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| rotate | Returns `rhs` rotated by the angle of `self`. If `self` is normalized, then this just rotation. Th... |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| rem-2 | No Documentation 🚧 |
| wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
| to_array | `[x, y]` |
| as_uvec2 | Casts all elements of `self` to `u32`. |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| rem-1 | No Documentation 🚧 |
| length_squared | Computes the squared length of `self`. |
| mul-2 | No Documentation 🚧 |
| div-1 | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| as_u64vec2 | Casts all elements of `self` to `u64`. |
| saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| add-1 | No Documentation 🚧 |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
| neg | No Documentation 🚧 |
| perp | Returns a vector that is equal to `self` rotated by 90 degrees. |
| as_i16vec2 | Casts all elements of `self` to `i16`. |
| as_i8vec2 | Casts all elements of `self` to `i8`. |
| mul-1 | No Documentation 🚧 |
| signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| as_vec2 | Casts all elements of `self` to `f32`. |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| is_negative_bitmask | Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. A negat... |
| as_dvec2 | Casts all elements of `self` to `f64`. |
| as_u8vec2 | Casts all elements of `self` to `u8`. |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| with_x | Creates a 2D vector from `self` with the given value of `x`. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| extend | Creates a 3D vector from `self` and the given `z` value. |
| rem | No Documentation 🚧 |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| sub-2 | No Documentation 🚧 |
| from_array | Creates a new vector from an array. |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| sub-1 | No Documentation 🚧 |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| clone | No Documentation 🚧 |
| dot | Computes the dot product of `self` and `rhs`. |
| add | No Documentation 🚧 |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| add-2 | No Documentation 🚧 |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| as_i64vec2 | Casts all elements of `self` to `i64`. |
| with_y | Creates a 2D vector from `self` with the given value of `y`. |
| splat | Creates a vector with all elements set to `v`. |
| clamp | Component-wise clamping of values, similar to [`i32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| div-2 | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| new | Creates a new vector. |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
as_u16vec2
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
perp_dot
The perpendicular dot product of
selfandrhs. Also known as the wedge product, 2D cross product, and determinant.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
rotate
Returns
rhsrotated by the angle ofself. Ifselfis normalized, then this just rotation. This is what you usually want. Otherwise, it will be like a rotation with a multiplication byself's length.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [i32; 2] | No Documentation 🚧 |
as_uvec2
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
perp
Returns a vector that is equal to
selfrotated by 90 degrees.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
as_i16vec2
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
as_i8vec2
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
0if the number is zero1if the number is positive-1if the number is negative
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow. [Euclidean division]: i32::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
as_dvec2
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
as_u8vec2
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
with_x
Creates a 2D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
extend
Creates a 3D vector from
selfand the givenzvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [i32; 2] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec2 | No Documentation 🚧 |
| if_true | IVec2 | No Documentation 🚧 |
| if_false | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
i32::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
| min | IVec2 | No Documentation 🚧 |
| max | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
IVec3
IVec3
- x:i32
- y:i32
- z:i32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| with_z | Creates a 3D vector from `self` with the given value of `z`. |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| mul-2 | No Documentation 🚧 |
| wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
| div-2 | No Documentation 🚧 |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
| with_x | Creates a 3D vector from `self` with the given value of `x`. |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| new | Creates a new vector. |
| as_i8vec3 | Casts all elements of `self` to `i8`. |
| wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| mul-1 | No Documentation 🚧 |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| from_array | Creates a new vector from an array. |
| as_u16vec3 | Casts all elements of `self` to `u16`. |
| add | No Documentation 🚧 |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| sub | No Documentation 🚧 |
| truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
| neg | No Documentation 🚧 |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| cross | Computes the cross product of `self` and `rhs`. |
| rem | No Documentation 🚧 |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| div | No Documentation 🚧 |
| to_array | `[x, y, z]` |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
| rem-2 | No Documentation 🚧 |
| add-1 | No Documentation 🚧 |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| as_vec3 | Casts all elements of `self` to `f32`. |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| as_u8vec3 | Casts all elements of `self` to `u8`. |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| as_i16vec3 | Casts all elements of `self` to `i16`. |
| sub-2 | No Documentation 🚧 |
| as_dvec3 | Casts all elements of `self` to `f64`. |
| clone | No Documentation 🚧 |
| rem-1 | No Documentation 🚧 |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
| is_negative_bitmask | Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. A negat... |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| div-1 | No Documentation 🚧 |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| clamp | Component-wise clamping of values, similar to [`i32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| as_uvec3 | Casts all elements of `self` to `u32`. |
| mul | No Documentation 🚧 |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| eq | No Documentation 🚧 |
| dot | Computes the dot product of `self` and `rhs`. |
| splat | Creates a vector with all elements set to `v`. |
| as_i64vec3 | Casts all elements of `self` to `i64`. |
| extend | Creates a 4D vector from `self` and the given `w` value. |
| as_vec3a | Casts all elements of `self` to `f32`. |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| with_y | Creates a 3D vector from `self` with the given value of `y`. |
| as_u64vec3 | Casts all elements of `self` to `u64`. |
| add-2 | No Documentation 🚧 |
| sub-1 | No Documentation 🚧 |
| length_squared | Computes the squared length of `self`. |
with_z
Creates a 3D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow. [Euclidean division]: i32::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
as_i8vec3
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [i32; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
as_u16vec3
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec3 | No Documentation 🚧 |
| if_true | IVec3 | No Documentation 🚧 |
| if_false | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
truncate
Creates a 2D vector from the
xandyelements ofself, discardingz. Truncation may also be performed by using [self.xy()][crate::swizzles::Vec3Swizzles::xy()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
cross
Computes the cross product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [i32; 3] | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
0if the number is zero1if the number is positive-1if the number is negative
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
as_vec3
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
as_u8vec3
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
as_i16vec3
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
i32::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
| min | IVec3 | No Documentation 🚧 |
| max | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
as_uvec3
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
selfand the givenwvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
as_vec3a
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
as_u64vec3
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
IVec4
IVec4
- x:i32
- y:i32
- z:i32
- w:i32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| rem-1 | No Documentation 🚧 |
| div | No Documentation 🚧 |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| add | No Documentation 🚧 |
| add-1 | No Documentation 🚧 |
| as_vec4 | Casts all elements of `self` to `f32`. |
| neg | No Documentation 🚧 |
| is_negative_bitmask | Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. A negat... |
| dot | Computes the dot product of `self` and `rhs`. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| clamp | Component-wise clamping of values, similar to [`i32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| saturating_sub_unsigned | Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. In oth... |
| clone | No Documentation 🚧 |
| sub-1 | No Documentation 🚧 |
| from_array | Creates a new vector from an array. |
| mul-1 | No Documentation 🚧 |
| wrapping_sub_unsigned | Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. In other... |
| rem-2 | No Documentation 🚧 |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| sub-2 | No Documentation 🚧 |
| as_dvec4 | Casts all elements of `self` to `f64`. |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| signum | Returns a vector with elements representing the sign of `self`. - `0` if the number is zero - `1`... |
| new | Creates a new vector. |
| as_i64vec4 | Casts all elements of `self` to `i64`. |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`IVec3`]... |
| wrapping_add_unsigned | Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. In other wo... |
| as_i16vec4 | Casts all elements of `self` to `i16`. |
| as_u8vec4 | Casts all elements of `self` to `u8`. |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| rem | No Documentation 🚧 |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| div-1 | No Documentation 🚧 |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| as_u16vec4 | Casts all elements of `self` to `u16`. |
| as_u64vec4 | Casts all elements of `self` to `u64`. |
| as_i8vec4 | Casts all elements of `self` to `i8`. |
| add-2 | No Documentation 🚧 |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| with_w | Creates a 4D vector from `self` with the given value of `w`. |
| sub | No Documentation 🚧 |
| mul-2 | No Documentation 🚧 |
| length_squared | Computes the squared length of `self`. |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. # Panics This function will panic if any `rhs` element is 0 or the division results in overflow. [Euclidean division]... |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| with_y | Creates a 4D vector from `self` with the given value of `y`. |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| with_z | Creates a 4D vector from `self` with the given value of `z`. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| with_x | Creates a 4D vector from `self` with the given value of `x`. |
| div-2 | No Documentation 🚧 |
| to_array | `[x, y, z, w]` |
| splat | Creates a vector with all elements set to `v`. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| eq | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| saturating_add_unsigned | In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| as_uvec4 | Casts all elements of `self` to `u32`. |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
as_vec4
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
i32::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
| min | IVec4 | No Documentation 🚧 |
| max | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
saturating_sub_unsigned
Returns a vector containing the saturating subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [i32; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
wrapping_sub_unsigned
Returns a vector containing the wrapping subtraction of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
as_dvec4
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
0if the number is zero1if the number is positive-1if the number is negative
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | i32 | No Documentation 🚧 |
| y | i32 | No Documentation 🚧 |
| z | i32 | No Documentation 🚧 |
| w | i32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
as_i64vec4
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec4 | No Documentation 🚧 |
| if_true | IVec4 | No Documentation 🚧 |
| if_false | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
truncate
Creates a 3D vector from the
x,yandzelements ofself, discardingw. Truncation to [IVec3] may also be performed by using [self.xyz()][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
wrapping_add_unsigned
Returns a vector containing the wrapping addition of
selfand unsigned vectorrhs. In other words this computes[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
as_i16vec4
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
as_u8vec4
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
as_u16vec4
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
as_u64vec4
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
as_i8vec4
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
with_w
Creates a 4D vector from
selfwith the given value ofw.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs.Panics
This function will panic if any
rhselement is 0 or the division results in overflow. [Euclidean division]: i32::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
with_z
Creates a 4D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [i32; 4] | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | i32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
saturating_add_unsigned
In other words this computes
[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | i32 | No Documentation 🚧 |
as_uvec4
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | IVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
Mat2
Mat2
- x_axis:glam::Vec2
- y_axis:glam::Vec2
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| to_cols_array_2d | Creates a `[[f32; 2]; 2]` 2D array storing data in column major order. If you require data in row ... |
| mul_mat2 | Multiplies two 2x2 matrices. |
| from_scale_angle | Creates a 2x2 matrix containing the combining non-uniform `scale` and rotation of `angle` (in radi... |
| from_mat3 | Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. |
| row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 1. |
| is_nan | Returns `true` if any elements are `NaN`. |
| to_cols_array | Creates a `[f32; 4]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
| from_mat3a | Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. |
| as_dmat2 | No Documentation 🚧 |
| from_mat3_minor | Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column and `j`th... |
| transpose | Returns the transpose of `self`. |
| mul_vec2 | Transforms a 2D vector. |
| from_mat3a_minor | Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the `i`th column and `j`th... |
| mul-1 | No Documentation 🚧 |
| sub_mat2 | Subtracts two 2x2 matrices. |
| neg | No Documentation 🚧 |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| from_cols | Creates a 2x2 matrix from two column vectors. |
| inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
| add | No Documentation 🚧 |
| div_scalar | Divides a 2x2 matrix by a scalar. |
| abs | Takes the absolute value of each element in `self` |
| eq | No Documentation 🚧 |
| div | No Documentation 🚧 |
| col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 1. |
| mul | No Documentation 🚧 |
| from_angle | Creates a 2x2 matrix containing a rotation of `angle` (in radians). |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
| mul-2 | No Documentation 🚧 |
| mul_scalar | Multiplies a 2x2 matrix by a scalar. |
| clone | No Documentation 🚧 |
| add_mat2 | Adds two 2x2 matrices. |
| from_diagonal | Creates a 2x2 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
| determinant | Returns the determinant of `self`. |
| sub | No Documentation 🚧 |
to_cols_array_2d
Creates a
[[f32; 2]; 2]2D array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [[f32; 2]; 2] | No Documentation 🚧 |
mul_mat2
Multiplies two 2x2 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
from_scale_angle
Creates a 2x2 matrix containing the combining non-uniform
scaleand rotation ofangle(in radians).
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
from_mat3
Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
row
Returns the matrix row for the given
index.Panics
Panics if
indexis greater than 1.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
to_cols_array
Creates a
[f32; 4]array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f32; 4] | No Documentation 🚧 |
from_mat3a
Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column.
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
as_dmat2
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat2 | No Documentation 🚧 |
from_mat3_minor
Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the
ith column andjth row.Panics
Panics if
iorjis greater than 2.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
transpose
Returns the transpose of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
mul_vec2
Transforms a 2D vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
from_mat3a_minor
Creates a 2x2 matrix from the minor of the given 3x3 matrix, discarding the
ith column andjth row.Panics
Panics if
iorjis greater than 2.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
sub_mat2
Subtracts two 2x2 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat2 | No Documentation 🚧 |
| rhs | Mat2 | No Documentation 🚧 |
| max_abs_diff | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_cols
Creates a 2x2 matrix from two column vectors.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
inverse
Returns the inverse of
self. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
selfis zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
div_scalar
Divides a 2x2 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
col
Returns the matrix column for the given
index.Panics
Panics if
indexis greater than 1.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
from_angle
Creates a 2x2 matrix containing a rotation of
angle(in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
mul_scalar
Multiplies a 2x2 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
add_mat2
Adds two 2x2 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
from_diagonal
Creates a 2x2 matrix with its diagonal set to
diagonaland all other entries set to 0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| diagonal | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
determinant
Returns the determinant of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat2 | No Documentation 🚧 |
Mat3
Mat3
- x_axis:glam::Vec3
- y_axis:glam::Vec3
- z_axis:glam::Vec3
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| from_translation | Creates an affine transformation matrix from the given 2D `translation`. The resulting matrix can ... |
| is_nan | Returns `true` if any elements are `NaN`. |
| mul-4 | No Documentation 🚧 |
| from_axis_angle | Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in radians). # Panics... |
| abs | Takes the absolute value of each element in `self` |
| add | No Documentation 🚧 |
| div | No Documentation 🚧 |
| determinant | Returns the determinant of `self`. |
| from_cols | Creates a 3x3 matrix from three column vectors. |
| transform_vector2 | Rotates the given 2D vector. This is the equivalent of multiplying `rhs` as a 3D vector where `z` ... |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| from_mat4 | Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. |
| as_dmat3 | No Documentation 🚧 |
| transpose | Returns the transpose of `self`. |
| transform_point2 | Transforms the given 2D vector as a point. This is the equivalent of multiplying `rhs` as a 3D vec... |
| mul_mat3 | Multiplies two 3x3 matrices. |
| neg | No Documentation 🚧 |
| mul_vec3 | Transforms a 3D vector. |
| eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| from_rotation_z | Creates a 3D rotation matrix from `angle` (in radians) around the z axis. |
| mul | No Documentation 🚧 |
| add_mat3 | Adds two 3x3 matrices. |
| from_angle | Creates an affine transformation matrix from the given 2D rotation `angle` (in radians). The resu... |
| from_diagonal | Creates a 3x3 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
| sub_mat3 | Subtracts two 3x3 matrices. |
| mul_vec3a | Transforms a [`Vec3A`]. |
| from_mat4_minor | Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the `i`th column and `j`th... |
| row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 2. |
| mul_scalar | Multiplies a 3x3 matrix by a scalar. |
| from_euler | Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians). |
| from_quat | Creates a 3D rotation matrix from the given quaternion. # Panics Will panic if `rotation` is not ... |
| sub | No Documentation 🚧 |
| col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 2. |
| div_scalar | Divides a 3x3 matrix by a scalar. |
| from_scale | Creates an affine transformation matrix from the given non-uniform 2D `scale`. The resulting matri... |
| mul-3 | No Documentation 🚧 |
| inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
| to_cols_array_2d | Creates a `[[f32; 3]; 3]` 3D array storing data in column major order. If you require data in row ... |
| from_rotation_x | Creates a 3D rotation matrix from `angle` (in radians) around the x axis. |
| from_mat2 | Creates an affine transformation matrix from the given 2x2 matrix. The resulting matrix can be use... |
| to_euler | Extract Euler angles with the given Euler rotation order. Note if the input matrix contains scales... |
| from_rotation_y | Creates a 3D rotation matrix from `angle` (in radians) around the y axis. |
| mul-2 | No Documentation 🚧 |
| mul-1 | No Documentation 🚧 |
| to_cols_array | Creates a `[f32; 9]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
| from_scale_angle_translation | Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in radians) a... |
from_translation
Creates an affine transformation matrix from the given 2D
translation. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()] and [Self::transform_vector2()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| translation | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
mul-4
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
from_axis_angle
Creates a 3D rotation matrix from a normalized rotation
axisandangle(in radians).Panics
Will panic if
axisis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
determinant
Returns the determinant of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_cols
Creates a 3x3 matrix from three column vectors.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x_axis | Vec3 | No Documentation 🚧 |
| y_axis | Vec3 | No Documentation 🚧 |
| z_axis | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
transform_vector2
Rotates the given 2D vector. This is the equivalent of multiplying
rhsas a 3D vector wherezis0. This method assumes thatselfcontains a valid affine transform.Panics
Will panic if the 2nd row of
selfis not(0, 0, 1)whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3 | No Documentation 🚧 |
| rhs | Mat3 | No Documentation 🚧 |
| max_abs_diff | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_mat4
Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column.
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
as_dmat3
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
transpose
Returns the transpose of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
transform_point2
Transforms the given 2D vector as a point. This is the equivalent of multiplying
rhsas a 3D vector wherezis1. This method assumes thatselfcontains a valid affine transform.Panics
Will panic if the 2nd row of
selfis not(0, 0, 1)whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
mul_mat3
Multiplies two 3x3 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
mul_vec3
Transforms a 3D vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
from_rotation_z
Creates a 3D rotation matrix from
angle(in radians) around the z axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
add_mat3
Adds two 3x3 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
from_angle
Creates an affine transformation matrix from the given 2D rotation
angle(in radians). The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()] and [Self::transform_vector2()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
from_diagonal
Creates a 3x3 matrix with its diagonal set to
diagonaland all other entries set to 0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| diagonal | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
sub_mat3
Subtracts two 3x3 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
mul_vec3a
Transforms a [
Vec3A].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
from_mat4_minor
Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the
ith column andjth row.Panics
Panics if
iorjis greater than 3.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
row
Returns the matrix row for the given
index.Panics
Panics if
indexis greater than 2.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
mul_scalar
Multiplies a 3x3 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
from_euler
Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| order | EulerRot | No Documentation 🚧 |
| a | f32 | No Documentation 🚧 |
| b | f32 | No Documentation 🚧 |
| c | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
from_quat
Creates a 3D rotation matrix from the given quaternion.
Panics
Will panic if
rotationis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| rotation | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
col
Returns the matrix column for the given
index.Panics
Panics if
indexis greater than 2.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
div_scalar
Divides a 3x3 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
from_scale
Creates an affine transformation matrix from the given non-uniform 2D
scale. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()] and [Self::transform_vector2()].Panics
Will panic if all elements of
scaleare zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
inverse
Returns the inverse of
self. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
selfis zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
to_cols_array_2d
Creates a
[[f32; 3]; 3]3D array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [[f32; 3]; 3] | No Documentation 🚧 |
from_rotation_x
Creates a 3D rotation matrix from
angle(in radians) around the x axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
from_mat2
Creates an affine transformation matrix from the given 2x2 matrix. The resulting matrix can be used to transform 2D points and vectors. See [
Self::transform_point2()] and [Self::transform_vector2()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
to_euler
Extract Euler angles with the given Euler rotation order. Note if the input matrix contains scales, shears, or other non-rotation transformations then the resulting Euler angles will be ill-defined.
Panics
Will panic if any input matrix column is not normalized when
glam_assertis enabled.
Arguments
Returns
from_rotation_y
Creates a 3D rotation matrix from
angle(in radians) around the y axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
to_cols_array
Creates a
[f32; 9]array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f32; 9] | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_scale_angle_translation
Creates an affine transformation matrix from the given 2D
scale, rotationangle(in radians) andtranslation. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()] and [Self::transform_vector2()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | Vec2 | No Documentation 🚧 |
| angle | f32 | No Documentation 🚧 |
| translation | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3 | No Documentation 🚧 |
Mat3A
Mat3A
- x_axis:glam::Vec3A
- y_axis:glam::Vec3A
- z_axis:glam::Vec3A
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| mul-2 | No Documentation 🚧 |
| transform_point2 | Transforms the given 2D vector as a point. This is the equivalent of multiplying `rhs` as a 3D vec... |
| from_mat4 | Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. |
| sub | No Documentation 🚧 |
| from_euler | Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians). |
| mul-4 | No Documentation 🚧 |
| add | No Documentation 🚧 |
| as_dmat3 | No Documentation 🚧 |
| from_translation | Creates an affine transformation matrix from the given 2D `translation`. The resulting matrix can ... |
| div | No Documentation 🚧 |
| transpose | Returns the transpose of `self`. |
| mul_vec3a | Transforms a [`Vec3A`]. |
| mul_vec3 | Transforms a 3D vector. |
| from_axis_angle | Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in radians). # Panics... |
| mul-3 | No Documentation 🚧 |
| mul-1 | No Documentation 🚧 |
| row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 2. |
| div_scalar | Divides a 3x3 matrix by a scalar. |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| from_rotation_x | Creates a 3D rotation matrix from `angle` (in radians) around the x axis. |
| clone | No Documentation 🚧 |
| from_diagonal | Creates a 3x3 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
| abs | Takes the absolute value of each element in `self` |
| from_scale | Creates an affine transformation matrix from the given non-uniform 2D `scale`. The resulting matri... |
| mul_mat3 | Multiplies two 3x3 matrices. |
| inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
| is_nan | Returns `true` if any elements are `NaN`. |
| from_mat2 | Creates an affine transformation matrix from the given 2x2 matrix. The resulting matrix can be use... |
| to_cols_array | Creates a `[f32; 9]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
| from_rotation_y | Creates a 3D rotation matrix from `angle` (in radians) around the y axis. |
| add_mat3 | Adds two 3x3 matrices. |
| sub_mat3 | Subtracts two 3x3 matrices. |
| to_cols_array_2d | Creates a `[[f32; 3]; 3]` 3D array storing data in column major order. If you require data in row ... |
| from_cols | Creates a 3x3 matrix from three column vectors. |
| from_scale_angle_translation | Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in radians) a... |
| to_euler | Extract Euler angles with the given Euler rotation order. Note if the input matrix contains scales... |
| mul | No Documentation 🚧 |
| transform_vector2 | Rotates the given 2D vector. This is the equivalent of multiplying `rhs` as a 3D vector where `z` ... |
| from_mat4_minor | Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the `i`th column and `j`th... |
| eq | No Documentation 🚧 |
| from_angle | Creates an affine transformation matrix from the given 2D rotation `angle` (in radians). The resu... |
| from_quat | Creates a 3D rotation matrix from the given quaternion. # Panics Will panic if `rotation` is not ... |
| col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 2. |
| mul_scalar | Multiplies a 3x3 matrix by a scalar. |
| neg | No Documentation 🚧 |
| determinant | Returns the determinant of `self`. |
| from_rotation_z | Creates a 3D rotation matrix from `angle` (in radians) around the z axis. |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
transform_point2
Transforms the given 2D vector as a point. This is the equivalent of multiplying
rhsas a 3D vector wherezis1. This method assumes thatselfcontains a valid affine transform.Panics
Will panic if the 2nd row of
selfis not(0, 0, 1)whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
from_mat4
Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column.
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
from_euler
Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| order | EulerRot | No Documentation 🚧 |
| a | f32 | No Documentation 🚧 |
| b | f32 | No Documentation 🚧 |
| c | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
mul-4
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
as_dmat3
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat3 | No Documentation 🚧 |
from_translation
Creates an affine transformation matrix from the given 2D
translation. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()] and [Self::transform_vector2()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| translation | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
transpose
Returns the transpose of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
mul_vec3a
Transforms a [
Vec3A].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
mul_vec3
Transforms a 3D vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
from_axis_angle
Creates a 3D rotation matrix from a normalized rotation
axisandangle(in radians).Panics
Will panic if
axisis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
row
Returns the matrix row for the given
index.Panics
Panics if
indexis greater than 2.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
div_scalar
Divides a 3x3 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3A | No Documentation 🚧 |
| rhs | Mat3A | No Documentation 🚧 |
| max_abs_diff | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_rotation_x
Creates a 3D rotation matrix from
angle(in radians) around the x axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
from_diagonal
Creates a 3x3 matrix with its diagonal set to
diagonaland all other entries set to 0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| diagonal | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
from_scale
Creates an affine transformation matrix from the given non-uniform 2D
scale. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()] and [Self::transform_vector2()].Panics
Will panic if all elements of
scaleare zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
mul_mat3
Multiplies two 3x3 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
inverse
Returns the inverse of
self. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
selfis zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_mat2
Creates an affine transformation matrix from the given 2x2 matrix. The resulting matrix can be used to transform 2D points and vectors. See [
Self::transform_point2()] and [Self::transform_vector2()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | Mat2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
to_cols_array
Creates a
[f32; 9]array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f32; 9] | No Documentation 🚧 |
from_rotation_y
Creates a 3D rotation matrix from
angle(in radians) around the y axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
add_mat3
Adds two 3x3 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
sub_mat3
Subtracts two 3x3 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
to_cols_array_2d
Creates a
[[f32; 3]; 3]3D array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [[f32; 3]; 3] | No Documentation 🚧 |
from_cols
Creates a 3x3 matrix from three column vectors.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x_axis | Vec3A | No Documentation 🚧 |
| y_axis | Vec3A | No Documentation 🚧 |
| z_axis | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
from_scale_angle_translation
Creates an affine transformation matrix from the given 2D
scale, rotationangle(in radians) andtranslation. The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()] and [Self::transform_vector2()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | Vec2 | No Documentation 🚧 |
| angle | f32 | No Documentation 🚧 |
| translation | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
to_euler
Extract Euler angles with the given Euler rotation order. Note if the input matrix contains scales, shears, or other non-rotation transformations then the resulting Euler angles will be ill-defined.
Panics
Will panic if any input matrix column is not normalized when
glam_assertis enabled.
Arguments
Returns
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
transform_vector2
Rotates the given 2D vector. This is the equivalent of multiplying
rhsas a 3D vector wherezis0. This method assumes thatselfcontains a valid affine transform.Panics
Will panic if the 2nd row of
selfis not(0, 0, 1)whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
from_mat4_minor
Creates a 3x3 matrix from the minor of the given 4x4 matrix, discarding the
ith column andjth row.Panics
Panics if
iorjis greater than 3.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_angle
Creates an affine transformation matrix from the given 2D rotation
angle(in radians). The resulting matrix can be used to transform 2D points and vectors. See [Self::transform_point2()] and [Self::transform_vector2()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
from_quat
Creates a 3D rotation matrix from the given quaternion.
Panics
Will panic if
rotationis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| rotation | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
col
Returns the matrix column for the given
index.Panics
Panics if
indexis greater than 2.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
mul_scalar
Multiplies a 3x3 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
determinant
Returns the determinant of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_rotation_z
Creates a 3D rotation matrix from
angle(in radians) around the z axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat3A | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
Mat4
Mat4
- x_axis:glam::Vec4
- y_axis:glam::Vec4
- z_axis:glam::Vec4
- w_axis:glam::Vec4
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| from_scale | Creates an affine transformation matrix containing the given 3D non-uniform `scale`. The resulting... |
| from_rotation_y | Creates an affine transformation matrix containing a 3D rotation around the y axis of `angle` (in ... |
| perspective_rh_gl | Creates a right-handed perspective projection matrix with `[-1,1]` depth range. Useful to map the standard right-handed coordinate system into what OpenGL expects. This is the same as the OpenGL `gluPerspective` function. See https://www\.khronos\.org/registry/OpenGL\-Refpages/gl2\.1/xhtml/gluPerspective\.xml |
| mul-2 | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| perspective_infinite_reverse_rh | Creates an infinite reverse right-handed perspective projection matrix with `[0,1]` depth range. Similar to `perspective_infinite_rh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. # Panics Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. |
| from_euler | Creates a affine transformation matrix containing a rotation from the given euler rotation sequenc... |
| mul_vec4 | Transforms a 4D vector. |
| perspective_rh | Creates a right-handed perspective projection matrix with `[0,1]` depth range. Useful to map the standard right-handed coordinate system into what WebGPU/Metal/Direct3D expect. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
| transpose | Returns the transpose of `self`. |
| mul_scalar | Multiplies a 4x4 matrix by a scalar. |
| transform_point3 | Transforms the given 3D vector as a point. This is the equivalent of multiplying the 3D vector as ... |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
| eq | No Documentation 🚧 |
| div | No Documentation 🚧 |
| from_cols | Creates a 4x4 matrix from four column vectors. |
| transform_vector3a | Transforms the give [`Vec3A`] as 3D vector. This is the equivalent of multiplying the [`Vec3A`] as... |
| as_dmat4 | No Documentation 🚧 |
| from_translation | Creates an affine transformation matrix from the given 3D `translation`. The resulting matrix can ... |
| from_rotation_translation | Creates an affine transformation matrix from the given 3D `translation`. The resulting matrix can ... |
| look_at_lh | Creates a left-handed view matrix using a camera position, an up direction, and a focal point. Fo... |
| perspective_lh | Creates a left-handed perspective projection matrix with `[0,1]` depth range. Useful to map the standard left-handed coordinate system into what WebGPU/Metal/Direct3D expect. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
| look_at_rh | Creates a right-handed view matrix using a camera position, an up direction, and a focal point. F... |
| from_axis_angle | Creates an affine transformation matrix containing a 3D rotation around a normalized rotation `axis`... |
| from_mat3a | Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resu... |
| to_cols_array_2d | Creates a `[[f32; 4]; 4]` 4D array storing data in column major order. If you require data in row ... |
| orthographic_rh_gl | Creates a right-handed orthographic projection matrix with `[-1,1]` depth range. This is the same as the OpenGL `glOrtho` function in OpenGL. See https://www\.khronos\.org/registry/OpenGL\-Refpages/gl2\.1/xhtml/glOrtho\.xml Useful to map a right-handed coordinate system to the normalized device coordinates that OpenGL expects. |
| from_mat3 | Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resu... |
| abs | Takes the absolute value of each element in `self` |
| from_rotation_z | Creates an affine transformation matrix containing a 3D rotation around the z axis of `angle` (in ... |
| row | Returns the matrix row for the given `index`. # Panics Panics if `index` is greater than 3. |
| from_scale_rotation_translation | Creates an affine transformation matrix from the given 3D `scale`, `rotation` and `translation`. ... |
| to_cols_array | Creates a `[f32; 16]` array storing data in column major order. If you require data in row major order `transpose` the matrix first. |
| clone | No Documentation 🚧 |
| transform_vector3 | Transforms the give 3D vector as a direction. This is the equivalent of multiplying the 3D vector ... |
| col | Returns the matrix column for the given `index`. # Panics Panics if `index` is greater than 3. |
| look_to_rh | Creates a right-handed view matrix using a camera position, an up direction, and a facing directio... |
| orthographic_rh | Creates a right-handed orthographic projection matrix with `[0,1]` depth range. Useful to map a right-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect. |
| inverse | Returns the inverse of `self`. If the matrix is not invertible the returned matrix will be invalid... |
| div_scalar | Divides a 4x4 matrix by a scalar. |
| mul-3 | No Documentation 🚧 |
| orthographic_lh | Creates a left-handed orthographic projection matrix with `[0,1]` depth range. Useful to map a left-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect. |
| sub_mat4 | Subtracts two 4x4 matrices. |
| look_to_lh | Creates a left-handed view matrix using a camera position, an up direction, and a facing direction... |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| neg | No Documentation 🚧 |
| add_mat4 | Adds two 4x4 matrices. |
| sub | No Documentation 🚧 |
| transform_point3a | Transforms the given [`Vec3A`] as 3D point. This is the equivalent of multiplying the [`Vec3A`] as... |
| from_diagonal | Creates a 4x4 matrix with its diagonal set to `diagonal` and all other entries set to 0. |
| project_point3a | Transforms the given [`Vec3A`] as a 3D point, applying perspective correction. This is the equivalent of multiplying the [`Vec3A`]... |
| perspective_infinite_rh | Creates an infinite right-handed perspective projection matrix with `[0,1]` depth range. Like `perspective_rh`, but with an infinite value for `z_far`. The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
| perspective_infinite_reverse_lh | Creates an infinite reverse left-handed perspective projection matrix with `[0,1]` depth range. Similar to `perspective_infinite_lh`, but maps `Z = z_near` to a depth of `1` and `Z = infinity` to a depth of `0`. # Panics Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. |
| determinant | Returns the determinant of `self`. |
| perspective_infinite_lh | Creates an infinite left-handed perspective projection matrix with `[0,1]` depth range. Like `perspective_lh`, but with an infinite value for `z_far`. The result is that points near `z_near` are mapped to depth `0`, and as they move towards infinity the depth approaches `1`. # Panics Will panic if `z_near` or `z_far` are less than or equal to zero when `glam_assert` is enabled. |
| from_rotation_x | Creates an affine transformation matrix containing a 3D rotation around the x axis of `angle` (in ... |
| add | No Documentation 🚧 |
| mul-1 | No Documentation 🚧 |
| mul_mat4 | Multiplies two 4x4 matrices. |
| to_euler | Extract Euler angles with the given Euler rotation order. Note if the upper 3x3 matrix contain sca... |
| is_nan | Returns `true` if any elements are `NaN`. |
| from_quat | Creates an affine transformation matrix from the given `rotation` quaternion. The resulting matrix... |
| project_point3 | Transforms the given 3D vector as a point, applying perspective correction. This is the equivalent... |
from_scale
Creates an affine transformation matrix containing the given 3D non-uniform
scale. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].Panics
Will panic if all elements of
scaleare zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
from_rotation_y
Creates an affine transformation matrix containing a 3D rotation around the y axis of
angle(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
perspective_rh_gl
Creates a right-handed perspective projection matrix with
[-1,1]depth range. Useful to map the standard right-handed coordinate system into what OpenGL expects. This is the same as the OpenGLgluPerspectivefunction. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f32 | No Documentation 🚧 |
| aspect_ratio | f32 | No Documentation 🚧 |
| z_near | f32 | No Documentation 🚧 |
| z_far | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
perspective_infinite_reverse_rh
Creates an infinite reverse right-handed perspective projection matrix with
[0,1]depth range. Similar toperspective_infinite_rh, but mapsZ = z_nearto a depth of1andZ = infinityto a depth of0.Panics
Will panic if
z_nearis less than or equal to zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f32 | No Documentation 🚧 |
| aspect_ratio | f32 | No Documentation 🚧 |
| z_near | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
from_euler
Creates a affine transformation matrix containing a rotation from the given euler rotation sequence and angles (in radians). The resulting matrix can be used to transform 3D points and vectors. See [
Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| order | EulerRot | No Documentation 🚧 |
| a | f32 | No Documentation 🚧 |
| b | f32 | No Documentation 🚧 |
| c | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
mul_vec4
Transforms a 4D vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
perspective_rh
Creates a right-handed perspective projection matrix with
[0,1]depth range. Useful to map the standard right-handed coordinate system into what WebGPU/Metal/Direct3D expect.Panics
Will panic if
z_nearorz_farare less than or equal to zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f32 | No Documentation 🚧 |
| aspect_ratio | f32 | No Documentation 🚧 |
| z_near | f32 | No Documentation 🚧 |
| z_far | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
transpose
Returns the transpose of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
mul_scalar
Multiplies a 4x4 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
transform_point3
Transforms the given 3D vector as a point. This is the equivalent of multiplying the 3D vector as a 4D vector where
wis1.0. This method assumes thatselfcontains a valid affine transform. It does not perform a perspective divide, ifselfcontains a perspective transform, or if you are unsure, the [Self::project_point3()] method should be used instead.Panics
Will panic if the 3rd row of
selfis not(0, 0, 0, 1)whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
from_cols
Creates a 4x4 matrix from four column vectors.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x_axis | Vec4 | No Documentation 🚧 |
| y_axis | Vec4 | No Documentation 🚧 |
| z_axis | Vec4 | No Documentation 🚧 |
| w_axis | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
transform_vector3a
Transforms the give [
Vec3A] as 3D vector. This is the equivalent of multiplying the [Vec3A] as a 4D vector wherewis0.0.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
as_dmat4
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DMat4 | No Documentation 🚧 |
from_translation
Creates an affine transformation matrix from the given 3D
translation. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| translation | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
from_rotation_translation
Creates an affine transformation matrix from the given 3D
translation. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].Panics
Will panic if
rotationis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
look_at_lh
Creates a left-handed view matrix using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right,+Y=upand+Z=forward.Panics
Will panic if
upis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| eye | Vec3 | No Documentation 🚧 |
| center | Vec3 | No Documentation 🚧 |
| up | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
perspective_lh
Creates a left-handed perspective projection matrix with
[0,1]depth range. Useful to map the standard left-handed coordinate system into what WebGPU/Metal/Direct3D expect.Panics
Will panic if
z_nearorz_farare less than or equal to zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f32 | No Documentation 🚧 |
| aspect_ratio | f32 | No Documentation 🚧 |
| z_near | f32 | No Documentation 🚧 |
| z_far | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
look_at_rh
Creates a right-handed view matrix using a camera position, an up direction, and a focal point. For a view coordinate system with
+X=right,+Y=upand+Z=back.Panics
Will panic if
upis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| eye | Vec3 | No Documentation 🚧 |
| center | Vec3 | No Documentation 🚧 |
| up | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
from_axis_angle
Creates an affine transformation matrix containing a 3D rotation around a normalized rotation
axisofangle(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].Panics
Will panic if
axisis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
from_mat3a
Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resulting matrix can be used to transform 3D points and vectors. See [
Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
to_cols_array_2d
Creates a
[[f32; 4]; 4]4D array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [[f32; 4]; 4] | No Documentation 🚧 |
orthographic_rh_gl
Creates a right-handed orthographic projection matrix with
[-1,1]depth range. This is the same as the OpenGLglOrthofunction in OpenGL. See https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glOrtho.xml Useful to map a right-handed coordinate system to the normalized device coordinates that OpenGL expects.
Arguments
| Name | Type | Documentation |
|---|---|---|
| left | f32 | No Documentation 🚧 |
| right | f32 | No Documentation 🚧 |
| bottom | f32 | No Documentation 🚧 |
| top | f32 | No Documentation 🚧 |
| near | f32 | No Documentation 🚧 |
| far | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
from_mat3
Creates an affine transformation matrix from the given 3x3 linear transformation matrix. The resulting matrix can be used to transform 3D points and vectors. See [
Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| m | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
abs
Takes the absolute value of each element in
self
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
from_rotation_z
Creates an affine transformation matrix containing a 3D rotation around the z axis of
angle(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
row
Returns the matrix row for the given
index.Panics
Panics if
indexis greater than 3.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
from_scale_rotation_translation
Creates an affine transformation matrix from the given 3D
scale,rotationandtranslation. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].Panics
Will panic if
rotationis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| scale | Vec3 | No Documentation 🚧 |
| rotation | Quat | No Documentation 🚧 |
| translation | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
to_cols_array
Creates a
[f32; 16]array storing data in column major order. If you require data in row major ordertransposethe matrix first.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f32; 16] | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
transform_vector3
Transforms the give 3D vector as a direction. This is the equivalent of multiplying the 3D vector as a 4D vector where
wis0.0. This method assumes thatselfcontains a valid affine transform.Panics
Will panic if the 3rd row of
selfis not(0, 0, 0, 1)whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
col
Returns the matrix column for the given
index.Panics
Panics if
indexis greater than 3.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
look_to_rh
Creates a right-handed view matrix using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right,+Y=upand+Z=back.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
orthographic_rh
Creates a right-handed orthographic projection matrix with
[0,1]depth range. Useful to map a right-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect.
Arguments
| Name | Type | Documentation |
|---|---|---|
| left | f32 | No Documentation 🚧 |
| right | f32 | No Documentation 🚧 |
| bottom | f32 | No Documentation 🚧 |
| top | f32 | No Documentation 🚧 |
| near | f32 | No Documentation 🚧 |
| far | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
inverse
Returns the inverse of
self. If the matrix is not invertible the returned matrix will be invalid.Panics
Will panic if the determinant of
selfis zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
div_scalar
Divides a 4x4 matrix by a scalar.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
orthographic_lh
Creates a left-handed orthographic projection matrix with
[0,1]depth range. Useful to map a left-handed coordinate system to the normalized device coordinates that WebGPU/Direct3D/Metal expect.
Arguments
| Name | Type | Documentation |
|---|---|---|
| left | f32 | No Documentation 🚧 |
| right | f32 | No Documentation 🚧 |
| bottom | f32 | No Documentation 🚧 |
| top | f32 | No Documentation 🚧 |
| near | f32 | No Documentation 🚧 |
| far | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
sub_mat4
Subtracts two 4x4 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
look_to_lh
Creates a left-handed view matrix using a camera position, an up direction, and a facing direction. For a view coordinate system with
+X=right,+Y=upand+Z=forward.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two matrices contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat4 | No Documentation 🚧 |
| rhs | Mat4 | No Documentation 🚧 |
| max_abs_diff | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
add_mat4
Adds two 4x4 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
transform_point3a
Transforms the given [
Vec3A] as 3D point. This is the equivalent of multiplying the [Vec3A] as a 4D vector wherewis1.0.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
from_diagonal
Creates a 4x4 matrix with its diagonal set to
diagonaland all other entries set to 0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| diagonal | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
project_point3a
Transforms the given [
Vec3A] as a 3D point, applying perspective correction. This is the equivalent of multiplying the [Vec3A] as a 4D vector wherewis1.0. The perspective divide is performed meaning the resulting 3D vector is divided byw. This method assumes thatselfcontains a projective transform.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
perspective_infinite_rh
Creates an infinite right-handed perspective projection matrix with
[0,1]depth range. Likeperspective_rh, but with an infinite value forz_far. The result is that points nearz_nearare mapped to depth0, and as they move towards infinity the depth approaches1.Panics
Will panic if
z_nearorz_farare less than or equal to zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f32 | No Documentation 🚧 |
| aspect_ratio | f32 | No Documentation 🚧 |
| z_near | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
perspective_infinite_reverse_lh
Creates an infinite reverse left-handed perspective projection matrix with
[0,1]depth range. Similar toperspective_infinite_lh, but mapsZ = z_nearto a depth of1andZ = infinityto a depth of0.Panics
Will panic if
z_nearis less than or equal to zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f32 | No Documentation 🚧 |
| aspect_ratio | f32 | No Documentation 🚧 |
| z_near | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
determinant
Returns the determinant of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
perspective_infinite_lh
Creates an infinite left-handed perspective projection matrix with
[0,1]depth range. Likeperspective_lh, but with an infinite value forz_far. The result is that points nearz_nearare mapped to depth0, and as they move towards infinity the depth approaches1.Panics
Will panic if
z_nearorz_farare less than or equal to zero whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| fov_y_radians | f32 | No Documentation 🚧 |
| aspect_ratio | f32 | No Documentation 🚧 |
| z_near | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
from_rotation_x
Creates an affine transformation matrix containing a 3D rotation around the x axis of
angle(in radians). The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
mul_mat4
Multiplies two 4x4 matrices.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
to_euler
Extract Euler angles with the given Euler rotation order. Note if the upper 3x3 matrix contain scales, shears, or other non-rotation transformations then the resulting Euler angles will be ill-defined.
Panics
Will panic if any column of the upper 3x3 rotation matrix is not normalized when
glam_assertis enabled.
Arguments
Returns
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_quat
Creates an affine transformation matrix from the given
rotationquaternion. The resulting matrix can be used to transform 3D points and vectors. See [Self::transform_point3()] and [Self::transform_vector3()].Panics
Will panic if
rotationis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| rotation | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Mat4 | No Documentation 🚧 |
project_point3
Transforms the given 3D vector as a point, applying perspective correction. This is the equivalent of multiplying the 3D vector as a 4D vector where
wis1.0. The perspective divide is performed meaning the resulting 3D vector is divided byw. This method assumes thatselfcontains a projective transform.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
Quat
Quat
- x:f32
- y:f32
- z:f32
- w:f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| is_near_identity | No Documentation 🚧 |
| from_affine3 | Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. Note if the input af... |
| xyz | Returns the vector part of the quaternion. |
| from_mat4 | Creates a quaternion from the upper 3x3 rotation matrix inside a homogeneous 4x4 matrix. Note if t... |
| from_rotation_arc | Gets the minimal rotation for transforming `from` to `to`. The rotation is in the plane spanned b... |
| from_xyzw | Creates a new rotation quaternion. This should generally not be called manually unless you know wh... |
| mul_vec3a | Multiplies a quaternion and a 3D vector, returning the rotated vector. |
| mul-3 | No Documentation 🚧 |
| length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
| from_rotation_y | Creates a quaternion from the `angle` (in radians) around the y axis. |
| is_normalized | Returns whether `self` of length `1.0` or not. Uses a precision threshold of `1e-6`. |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive ... |
| from_mat3a | Creates a quaternion from a 3x3 SIMD aligned rotation matrix. Note if the input matrix contain sca... |
| div | Divides a quaternion by a scalar value. The quotient is not guaranteed to be normalized. |
| mul | Multiplies two quaternions. If they each represent a rotation, the result will represent the combi... |
| mul-2 | No Documentation 🚧 |
| from_rotation_z | Creates a quaternion from the `angle` (in radians) around the z axis. |
| from_rotation_x | Creates a quaternion from the `angle` (in radians) around the x axis. |
| conjugate | Returns the quaternion conjugate of `self`. For a unit quaternion the conjugate is also the invers... |
| is_nan | Returns `true` if any elements are `NAN`. |
| inverse | Returns the inverse of a normalized quaternion. Typically quaternion inverse returns the conjugate... |
| neg | No Documentation 🚧 |
| mul-1 | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| length | Computes the length of `self`. |
| as_dquat | No Documentation 🚧 |
| from_vec4 | Creates a new rotation quaternion from a 4D vector. # Preconditions This function does not check ... |
| from_array | Creates a rotation quaternion from an array. # Preconditions This function does not check if the ... |
| to_array | `[x, y, z, w]` |
| length_squared | Computes the squared length of `self`. This is generally faster than `length()` as it avoids a squ... |
| mul_quat | Multiplies two quaternions. If they each represent a rotation, the result will represent the combi... |
| sub | Subtracts the `rhs` quaternion from `self`. The difference is not guaranteed to be normalized. |
| from_rotation_arc_2d | Gets the minimal rotation for transforming `from` to `to`. The resulting rotation is around the z... |
| slerp | Performs a spherical linear interpolation between `self` and `end` based on the value `s`. When `s`... |
| rotate_towards | Rotates towards `rhs` up to `max_angle` (in radians). When `max_angle` is `0.0`, the result will b... |
| to_euler | Returns the rotation angles for the given euler rotation sequence. |
| from_rotation_arc_colinear | Gets the minimal rotation for transforming `from` to either `to` or `-to`. This means that the re... |
| from_mat3 | Creates a quaternion from a 3x3 rotation matrix. Note if the input matrix contain scales, shears, ... |
| from_axis_angle | Create a quaternion for a normalized rotation `axis` and `angle` (in radians). The axis must be a ... |
| lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0... |
| to_scaled_axis | Returns the rotation axis scaled by the rotation in radians. |
| add | Adds two quaternions. The sum is not guaranteed to be normalized. Note that addition is not the s... |
| from_euler | Creates a quaternion from the given Euler rotation sequence and the angles (in radians). |
| normalize | Returns `self` normalized to length 1.0. For valid results, `self` must _not_ be of length zero. ... |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| clone | No Documentation 🚧 |
| dot | Computes the dot product of `self` and `rhs`. The dot product is equal to the cosine of the angle ... |
| angle_between | Returns the angle (in radians) for the minimal rotation for transforming this quaternion into anot... |
| mul_vec3 | Multiplies a quaternion and a 3D vector, returning the rotated vector. # Panics Will panic if `self`... |
| from_scaled_axis | Create a quaternion that rotates `v.length()` radians around `v.normalize()`. `from_scaled_axis(Vec3::ZERO)`... |
is_near_identity
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_affine3
Creates a quaternion from a 3x3 rotation matrix inside a 3D affine transform. Note if the input affine matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any input affine matrix column is not normalized when
glam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | Affine3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
xyz
Returns the vector part of the quaternion.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
from_mat4
Creates a quaternion from the upper 3x3 rotation matrix inside a homogeneous 4x4 matrix. Note if the upper 3x3 matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any column of the upper 3x3 rotation matrix is not normalized when
glam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mat | Mat4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
from_rotation_arc
Gets the minimal rotation for transforming
fromtoto. The rotation is in the plane spanned by the two vectors. Will rotate at most 180 degrees. The inputs must be unit vectors.from_rotation_arc(from, to) * from ≈ to. For near-singular cases (from≈to and from≈-to) the current implementation is only accurate to about 0.001 (forf32).Panics
Will panic if
fromortoare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
from_xyzw
Creates a new rotation quaternion. This should generally not be called manually unless you know what you are doing. Use one of the other constructors instead such as
identityorfrom_axis_angle.from_xyzwis mostly used by unit tests andserdedeserialization.Preconditions
This function does not check if the input is normalized, it is up to the user to provide normalized input or to normalized the resulting quaternion.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | f32 | No Documentation 🚧 |
| y | f32 | No Documentation 🚧 |
| z | f32 | No Documentation 🚧 |
| w | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
mul_vec3a
Multiplies a quaternion and a 3D vector, returning the rotated vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
mul-3
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
length_recip
Computes
1.0 / length(). For valid results,selfmust not be of length zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
from_rotation_y
Creates a quaternion from the
angle(in radians) around the y axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
is_normalized
Returns whether
selfof length1.0or not. Uses a precision threshold of1e-6.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_mat3a
Creates a quaternion from a 3x3 SIMD aligned rotation matrix. Note if the input matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any input matrix column is not normalized when
glam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mat | Mat3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
div
Divides a quaternion by a scalar value. The quotient is not guaranteed to be normalized.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
mul
Multiplies two quaternions. If they each represent a rotation, the result will represent the combined rotation. Note that due to floating point rounding the result may not be perfectly normalized.
Panics
Will panic if
selforrhsare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
from_rotation_z
Creates a quaternion from the
angle(in radians) around the z axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
from_rotation_x
Creates a quaternion from the
angle(in radians) around the x axis.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
conjugate
Returns the quaternion conjugate of
self. For a unit quaternion the conjugate is also the inverse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNAN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
inverse
Returns the inverse of a normalized quaternion. Typically quaternion inverse returns the conjugate of a normalized quaternion. Because
selfis assumed to already be unit length this method does not normalize before returning the conjugate.Panics
Will panic if
selfis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
length
Computes the length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
as_dquat
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DQuat | No Documentation 🚧 |
from_vec4
Creates a new rotation quaternion from a 4D vector.
Preconditions
This function does not check if the input is normalized, it is up to the user to provide normalized input or to normalized the resulting quaternion.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
from_array
Creates a rotation quaternion from an array.
Preconditions
This function does not check if the input is normalized, it is up to the user to provide normalized input or to normalized the resulting quaternion.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [f32; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f32; 4] | No Documentation 🚧 |
length_squared
Computes the squared length of
self. This is generally faster thanlength()as it avoids a square root operation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
mul_quat
Multiplies two quaternions. If they each represent a rotation, the result will represent the combined rotation. Note that due to floating point rounding the result may not be perfectly normalized.
Panics
Will panic if
selforrhsare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
sub
Subtracts the
rhsquaternion fromself. The difference is not guaranteed to be normalized.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
from_rotation_arc_2d
Gets the minimal rotation for transforming
fromtoto. The resulting rotation is around the z axis. Will rotate at most 180 degrees. The inputs must be unit vectors.from_rotation_arc_2d(from, to) * from ≈ to. For near-singular cases (from≈to and from≈-to) the current implementation is only accurate to about 0.001 (forf32).Panics
Will panic if
fromortoare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
slerp
Performs a spherical linear interpolation between
selfandendbased on the values. Whensis0.0, the result will be equal toself. Whensis1.0, the result will be equal toend.Panics
Will panic if
selforendare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
rotate_towards
Rotates towards
rhsup tomax_angle(in radians). Whenmax_angleis0.0, the result will be equal toself. Whenmax_angleis equal toself.angle_between(rhs), the result will be equal torhs. Ifmax_angleis negative, rotates towards the exact opposite ofrhs. Will not go past the target. Both quaternions must be normalized.Panics
Will panic if
selforrhsare not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
| rhs | Quat | No Documentation 🚧 |
| max_angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
to_euler
Returns the rotation angles for the given euler rotation sequence.
Arguments
Returns
from_rotation_arc_colinear
Gets the minimal rotation for transforming
fromto eithertoor-to. This means that the resulting quaternion will rotatefromso that it is colinear withto. The rotation is in the plane spanned by the two vectors. Will rotate at most 90 degrees. The inputs must be unit vectors.to.dot(from_rotation_arc_colinear(from, to) * from).abs() ≈ 1.Panics
Will panic if
fromortoare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
from_mat3
Creates a quaternion from a 3x3 rotation matrix. Note if the input matrix contain scales, shears, or other non-rotation transformations then the resulting quaternion will be ill-defined.
Panics
Will panic if any input matrix column is not normalized when
glam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mat | Mat3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
from_axis_angle
Create a quaternion for a normalized rotation
axisandangle(in radians). The axis must be a unit vector.Panics
Will panic if
axisis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
lerp
Performs a linear interpolation between
selfandrhsbased on the values. Whensis0.0, the result will be equal toself. Whensis1.0, the result will be equal torhs.Panics
Will panic if
selforendare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
to_scaled_axis
Returns the rotation axis scaled by the rotation in radians.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
add
Adds two quaternions. The sum is not guaranteed to be normalized. Note that addition is not the same as combining the rotations represented by the two quaternions! That corresponds to multiplication.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
from_euler
Creates a quaternion from the given Euler rotation sequence and the angles (in radians).
Arguments
| Name | Type | Documentation |
|---|---|---|
| euler | EulerRot | No Documentation 🚧 |
| a | f32 | No Documentation 🚧 |
| b | f32 | No Documentation 🚧 |
| c | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
normalize
Returns
selfnormalized to length 1.0. For valid results,selfmust not be of length zero. Panics Will panic ifselfis zero length whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two quaternions contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
| rhs | Quat | No Documentation 🚧 |
| max_abs_diff | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Quat | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs. The dot product is equal to the cosine of the angle between two quaternion rotations.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
angle_between
Returns the angle (in radians) for the minimal rotation for transforming this quaternion into another. Both quaternions must be normalized.
Panics
Will panic if
selforrhsare not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
mul_vec3
Multiplies a quaternion and a 3D vector, returning the rotated vector.
Panics
Will panic if
selfis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
from_scaled_axis
Create a quaternion that rotates
v.length()radians aroundv.normalize().from_scaled_axis(Vec3::ZERO)results in the identity quaternion.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Quat | No Documentation 🚧 |
U16Vec2
U16Vec2
- x:u16
- y:u16
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| length_squared | Computes the squared length of `self`. |
| div | No Documentation 🚧 |
| div-1 | No Documentation 🚧 |
| sub | No Documentation 🚧 |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| add-1 | No Documentation 🚧 |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
| add | No Documentation 🚧 |
| sub-2 | No Documentation 🚧 |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| mul-1 | No Documentation 🚧 |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| mul-2 | No Documentation 🚧 |
| new | Creates a new vector. |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| with_y | Creates a 2D vector from `self` with the given value of `y`. |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| as_dvec2 | Casts all elements of `self` to `f64`. |
| sub-1 | No Documentation 🚧 |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| as_i8vec2 | Casts all elements of `self` to `i8`. |
| as_vec2 | Casts all elements of `self` to `f32`. |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| as_ivec2 | Casts all elements of `self` to `i32`. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| with_x | Creates a 2D vector from `self` with the given value of `x`. |
| clone | No Documentation 🚧 |
| as_i64vec2 | Casts all elements of `self` to `i64`. |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| splat | Creates a vector with all elements set to `v`. |
| to_array | `[x, y]` |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| extend | Creates a 3D vector from `self` and the given `z` value. |
| as_u64vec2 | Casts all elements of `self` to `u64`. |
| div-2 | No Documentation 🚧 |
| add-2 | No Documentation 🚧 |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| mul | No Documentation 🚧 |
| as_uvec2 | Casts all elements of `self` to `u32`. |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| eq | No Documentation 🚧 |
| as_i16vec2 | Casts all elements of `self` to `i16`. |
| dot | Computes the dot product of `self` and `rhs`. |
| from_array | Creates a new vector from an array. |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| as_u8vec2 | Casts all elements of `self` to `u8`. |
| saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
| rem-1 | No Documentation 🚧 |
| clamp | Component-wise clamping of values, similar to [`u16::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| rem-2 | No Documentation 🚧 |
| rem | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec2 | No Documentation 🚧 |
| if_true | U16Vec2 | No Documentation 🚧 |
| if_false | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
wrapping_add_signed
Returns a vector containing the wrapping addition of
selfand signed vectorrhs. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
as_dvec2
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
as_i8vec2
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
as_ivec2
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
with_x
Creates a 2D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u16; 2] | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
extend
Creates a 3D vector from
selfand the givenzvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
as_uvec2
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_i16vec2
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [u16; 2] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
as_u8vec2
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
saturating_add_signed
Returns a vector containing the saturating addition of
selfand signed vectorrhs. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
u16::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec2 | No Documentation 🚧 |
| min | U16Vec2 | No Documentation 🚧 |
| max | U16Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
U16Vec3
U16Vec3
- x:u16
- y:u16
- z:u16
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| div-2 | No Documentation 🚧 |
| rem | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| add-1 | No Documentation 🚧 |
| truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
| from_array | Creates a new vector from an array. |
| as_dvec3 | Casts all elements of `self` to `f64`. |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| with_z | Creates a 3D vector from `self` with the given value of `z`. |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| dot | Computes the dot product of `self` and `rhs`. |
| add-2 | No Documentation 🚧 |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| new | Creates a new vector. |
| as_uvec3 | Casts all elements of `self` to `u32`. |
| rem-2 | No Documentation 🚧 |
| as_i64vec3 | Casts all elements of `self` to `i64`. |
| as_u8vec3 | Casts all elements of `self` to `u8`. |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| as_i16vec3 | Casts all elements of `self` to `i16`. |
| add | No Documentation 🚧 |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| clone | No Documentation 🚧 |
| clamp | Component-wise clamping of values, similar to [`u16::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| div | No Documentation 🚧 |
| wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
| as_vec3a | Casts all elements of `self` to `f32`. |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| sub | No Documentation 🚧 |
| splat | Creates a vector with all elements set to `v`. |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| extend | Creates a 4D vector from `self` and the given `w` value. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| rem-1 | No Documentation 🚧 |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| as_u64vec3 | Casts all elements of `self` to `u64`. |
| sub-2 | No Documentation 🚧 |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| mul | No Documentation 🚧 |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| length_squared | Computes the squared length of `self`. |
| saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
| mul-2 | No Documentation 🚧 |
| cross | Computes the cross product of `self` and `rhs`. |
| with_x | Creates a 3D vector from `self` with the given value of `x`. |
| mul-1 | No Documentation 🚧 |
| as_i8vec3 | Casts all elements of `self` to `i8`. |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| eq | No Documentation 🚧 |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| as_ivec3 | Casts all elements of `self` to `i32`. |
| with_y | Creates a 3D vector from `self` with the given value of `y`. |
| to_array | `[x, y, z]` |
| as_vec3 | Casts all elements of `self` to `f32`. |
| div-1 | No Documentation 🚧 |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| sub-1 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
truncate
Creates a 2D vector from the
xandyelements ofself, discardingz. Truncation may also be performed by using [self.xy()][crate::swizzles::Vec3Swizzles::xy()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [u16; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
as_uvec3
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
as_u8vec3
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
as_i16vec3
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
u16::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
| min | U16Vec3 | No Documentation 🚧 |
| max | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
wrapping_add_signed
Returns a vector containing the wrapping addition of
selfand signed vectorrhs. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
selfand the givenwvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
as_u64vec3
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
saturating_add_signed
Returns a vector containing the saturating addition of
selfand signed vectorrhs. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
cross
Computes the cross product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
as_i8vec3
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec3 | No Documentation 🚧 |
| if_true | U16Vec3 | No Documentation 🚧 |
| if_false | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
as_ivec3
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u16; 3] | No Documentation 🚧 |
as_vec3
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
U16Vec4
U16Vec4
- x:u16
- y:u16
- z:u16
- w:u16
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| as_vec4 | Casts all elements of `self` to `f32`. |
| as_i64vec4 | Casts all elements of `self` to `i64`. |
| sub | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| as_u64vec4 | Casts all elements of `self` to `u64`. |
| as_u8vec4 | Casts all elements of `self` to `u8`. |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| div-1 | No Documentation 🚧 |
| div-2 | No Documentation 🚧 |
| to_array | `[x, y, z, w]` |
| as_i16vec4 | Casts all elements of `self` to `i16`. |
| splat | Creates a vector with all elements set to `v`. |
| with_w | Creates a 4D vector from `self` with the given value of `w`. |
| dot | Computes the dot product of `self` and `rhs`. |
| div | No Documentation 🚧 |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| as_uvec4 | Casts all elements of `self` to `u32`. |
| as_dvec4 | Casts all elements of `self` to `f64`. |
| clamp | Component-wise clamping of values, similar to [`u16::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| mul-1 | No Documentation 🚧 |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| from_array | Creates a new vector from an array. |
| new | Creates a new vector. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| as_i8vec4 | Casts all elements of `self` to `i8`. |
| add | No Documentation 🚧 |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| add-2 | No Documentation 🚧 |
| with_z | Creates a 4D vector from `self` with the given value of `z`. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| rem-2 | No Documentation 🚧 |
| wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| sub-2 | No Documentation 🚧 |
| rem-1 | No Documentation 🚧 |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| rem | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| sub-1 | No Documentation 🚧 |
| add-1 | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| as_ivec4 | Casts all elements of `self` to `i32`. |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`U16Vec3`]... |
| mul-2 | No Documentation 🚧 |
| length_squared | Computes the squared length of `self`. |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| with_y | Creates a 4D vector from `self` with the given value of `y`. |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| with_x | Creates a 4D vector from `self` with the given value of `x`. |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
as_vec4
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
as_i64vec4
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_u64vec4
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
as_u8vec4
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u16; 4] | No Documentation 🚧 |
as_i16vec4
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
selfwith the given value ofw.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
as_uvec4
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
as_dvec4
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
u16::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
| min | U16Vec4 | No Documentation 🚧 |
| max | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [u16; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | u16 | No Documentation 🚧 |
| y | u16 | No Documentation 🚧 |
| z | u16 | No Documentation 🚧 |
| w | u16 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec4 | No Documentation 🚧 |
| if_true | U16Vec4 | No Documentation 🚧 |
| if_false | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
as_i8vec4
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
with_z
Creates a 4D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
wrapping_add_signed
Returns a vector containing the wrapping addition of
selfand signed vectorrhs. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
truncate
Creates a 3D vector from the
x,yandzelements ofself, discardingw. Truncation to [U16Vec3] may also be performed by using [self.xyz()][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U16Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u16 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
saturating_add_signed
Returns a vector containing the saturating addition of
selfand signed vectorrhs. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
U64Vec2
U64Vec2
- x:u64
- y:u64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| sub-2 | No Documentation 🚧 |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| add-1 | No Documentation 🚧 |
| as_ivec2 | Casts all elements of `self` to `i32`. |
| mul-2 | No Documentation 🚧 |
| rem-2 | No Documentation 🚧 |
| with_y | Creates a 2D vector from `self` with the given value of `y`. |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| rem | No Documentation 🚧 |
| as_vec2 | Casts all elements of `self` to `f32`. |
| sub | No Documentation 🚧 |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| clone | No Documentation 🚧 |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| as_uvec2 | Casts all elements of `self` to `u32`. |
| as_u8vec2 | Casts all elements of `self` to `u8`. |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| eq | No Documentation 🚧 |
| dot | Computes the dot product of `self` and `rhs`. |
| mul-1 | No Documentation 🚧 |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| add-2 | No Documentation 🚧 |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| as_i64vec2 | Casts all elements of `self` to `i64`. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| new | Creates a new vector. |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| as_i8vec2 | Casts all elements of `self` to `i8`. |
| div | No Documentation 🚧 |
| div-2 | No Documentation 🚧 |
| div-1 | No Documentation 🚧 |
| from_array | Creates a new vector from an array. |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| extend | Creates a 3D vector from `self` and the given `z` value. |
| saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| with_x | Creates a 2D vector from `self` with the given value of `x`. |
| clamp | Component-wise clamping of values, similar to [`u64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| as_i16vec2 | Casts all elements of `self` to `i16`. |
| as_u16vec2 | Casts all elements of `self` to `u16`. |
| sub-1 | No Documentation 🚧 |
| add | No Documentation 🚧 |
| length_squared | Computes the squared length of `self`. |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| splat | Creates a vector with all elements set to `v`. |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| rem-1 | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
| to_array | `[x, y]` |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| as_dvec2 | Casts all elements of `self` to `f64`. |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
as_ivec2
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec2 | No Documentation 🚧 |
| if_true | U64Vec2 | No Documentation 🚧 |
| if_false | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
as_uvec2
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
as_u8vec2
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
as_i8vec2
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [u64; 2] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
extend
Creates a 3D vector from
selfand the givenzvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
saturating_add_signed
Returns a vector containing the saturating addition of
selfand signed vectorrhs. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
with_x
Creates a 2D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
u64::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
| min | U64Vec2 | No Documentation 🚧 |
| max | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
as_i16vec2
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
as_u16vec2
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
wrapping_add_signed
Returns a vector containing the wrapping addition of
selfand signed vectorrhs. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u64; 2] | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
as_dvec2
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
U64Vec3
U64Vec3
- x:u64
- y:u64
- z:u64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| sub | No Documentation 🚧 |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| add-1 | No Documentation 🚧 |
| add-2 | No Documentation 🚧 |
| sub-2 | No Documentation 🚧 |
| dot | Computes the dot product of `self` and `rhs`. |
| as_u8vec3 | Casts all elements of `self` to `u8`. |
| as_vec3a | Casts all elements of `self` to `f32`. |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| div-2 | No Documentation 🚧 |
| div-1 | No Documentation 🚧 |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| as_vec3 | Casts all elements of `self` to `f32`. |
| from_array | Creates a new vector from an array. |
| to_array | `[x, y, z]` |
| add | No Documentation 🚧 |
| as_dvec3 | Casts all elements of `self` to `f64`. |
| length_squared | Computes the squared length of `self`. |
| div | No Documentation 🚧 |
| wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
| rem | No Documentation 🚧 |
| as_i64vec3 | Casts all elements of `self` to `i64`. |
| with_z | Creates a 3D vector from `self` with the given value of `z`. |
| clamp | Component-wise clamping of values, similar to [`u64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| sub-1 | No Documentation 🚧 |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| rem-2 | No Documentation 🚧 |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| with_x | Creates a 3D vector from `self` with the given value of `x`. |
| extend | Creates a 4D vector from `self` and the given `w` value. |
| cross | Computes the cross product of `self` and `rhs`. |
| truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
| with_y | Creates a 3D vector from `self` with the given value of `y`. |
| as_ivec3 | Casts all elements of `self` to `i32`. |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| as_i16vec3 | Casts all elements of `self` to `i16`. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
| mul-2 | No Documentation 🚧 |
| rem-1 | No Documentation 🚧 |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| as_u16vec3 | Casts all elements of `self` to `u16`. |
| as_i8vec3 | Casts all elements of `self` to `i8`. |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| clone | No Documentation 🚧 |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| mul | No Documentation 🚧 |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| mul-1 | No Documentation 🚧 |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| eq | No Documentation 🚧 |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| new | Creates a new vector. |
| as_uvec3 | Casts all elements of `self` to `u32`. |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| splat | Creates a vector with all elements set to `v`. |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
as_u8vec3
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
as_vec3
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [u64; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u64; 3] | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
wrapping_add_signed
Returns a vector containing the wrapping addition of
selfand signed vectorrhs. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
u64::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
| min | U64Vec3 | No Documentation 🚧 |
| max | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec3 | No Documentation 🚧 |
| if_true | U64Vec3 | No Documentation 🚧 |
| if_false | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
selfand the givenwvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
cross
Computes the cross product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
truncate
Creates a 2D vector from the
xandyelements ofself, discardingz. Truncation may also be performed by using [self.xy()][crate::swizzles::Vec3Swizzles::xy()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
with_y
Creates a 3D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
as_ivec3
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
as_i16vec3
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
saturating_add_signed
Returns a vector containing the saturating addition of
selfand signed vectorrhs. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
as_u16vec3
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
as_i8vec3
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
as_uvec3
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
U64Vec4
U64Vec4
- x:u64
- y:u64
- z:u64
- w:u64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| with_x | Creates a 4D vector from `self` with the given value of `x`. |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| sub-2 | No Documentation 🚧 |
| as_i16vec4 | Casts all elements of `self` to `i16`. |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| add-1 | No Documentation 🚧 |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| as_u8vec4 | Casts all elements of `self` to `u8`. |
| with_y | Creates a 4D vector from `self` with the given value of `y`. |
| as_uvec4 | Casts all elements of `self` to `u32`. |
| rem-1 | No Documentation 🚧 |
| rem | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| div | No Documentation 🚧 |
| mul-1 | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| new | Creates a new vector. |
| sub | No Documentation 🚧 |
| rem-2 | No Documentation 🚧 |
| as_ivec4 | Casts all elements of `self` to `i32`. |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| from_array | Creates a new vector from an array. |
| add | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| as_dvec4 | Casts all elements of `self` to `f64`. |
| dot | Computes the dot product of `self` and `rhs`. |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| to_array | `[x, y, z, w]` |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| as_i64vec4 | Casts all elements of `self` to `i64`. |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| clamp | Component-wise clamping of values, similar to [`u64::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| with_z | Creates a 4D vector from `self` with the given value of `z`. |
| wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
| as_i8vec4 | Casts all elements of `self` to `i8`. |
| mul-2 | No Documentation 🚧 |
| with_w | Creates a 4D vector from `self` with the given value of `w`. |
| add-2 | No Documentation 🚧 |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`U64Vec3`]... |
| saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
| length_squared | Computes the squared length of `self`. |
| div-1 | No Documentation 🚧 |
| as_vec4 | Casts all elements of `self` to `f32`. |
| splat | Creates a vector with all elements set to `v`. |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| div-2 | No Documentation 🚧 |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| as_u16vec4 | Casts all elements of `self` to `u16`. |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| sub-1 | No Documentation 🚧 |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
with_x
Creates a 4D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
as_i16vec4
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
as_u8vec4
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
as_uvec4
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec4 | No Documentation 🚧 |
| if_true | U64Vec4 | No Documentation 🚧 |
| if_false | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | u64 | No Documentation 🚧 |
| y | u64 | No Documentation 🚧 |
| z | u64 | No Documentation 🚧 |
| w | u64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [u64; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_dvec4
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u64; 4] | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
as_i64vec4
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
u64::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
| min | U64Vec4 | No Documentation 🚧 |
| max | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
with_z
Creates a 4D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
wrapping_add_signed
Returns a vector containing the wrapping addition of
selfand signed vectorrhs. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
as_i8vec4
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
selfwith the given value ofw.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
truncate
Creates a 3D vector from the
x,yandzelements ofself, discardingw. Truncation to [U64Vec3] may also be performed by using [self.xyz()][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
saturating_add_signed
Returns a vector containing the saturating addition of
selfand signed vectorrhs. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u64 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
as_vec4
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u64 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
as_u16vec4
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U64Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
U8Vec2
U8Vec2
- x:u8
- y:u8
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| extend | Creates a 3D vector from `self` and the given `z` value. |
| as_u16vec2 | Casts all elements of `self` to `u16`. |
| saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
| as_uvec2 | Casts all elements of `self` to `u32`. |
| div | No Documentation 🚧 |
| mul-2 | No Documentation 🚧 |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| clone | No Documentation 🚧 |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| clamp | Component-wise clamping of values, similar to [`u8::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| sub-1 | No Documentation 🚧 |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| sub-2 | No Documentation 🚧 |
| with_y | Creates a 2D vector from `self` with the given value of `y`. |
| div-2 | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| as_ivec2 | Casts all elements of `self` to `i32`. |
| wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| length_squared | Computes the squared length of `self`. |
| as_u64vec2 | Casts all elements of `self` to `u64`. |
| sub | No Documentation 🚧 |
| as_i8vec2 | Casts all elements of `self` to `i8`. |
| from_array | Creates a new vector from an array. |
| mul-1 | No Documentation 🚧 |
| to_array | `[x, y]` |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| with_x | Creates a 2D vector from `self` with the given value of `x`. |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| splat | Creates a vector with all elements set to `v`. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| as_vec2 | Casts all elements of `self` to `f32`. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| as_dvec2 | Casts all elements of `self` to `f64`. |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| rem | No Documentation 🚧 |
| as_i16vec2 | Casts all elements of `self` to `i16`. |
| add | No Documentation 🚧 |
| new | Creates a new vector. |
| dot | Computes the dot product of `self` and `rhs`. |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| rem-2 | No Documentation 🚧 |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| div-1 | No Documentation 🚧 |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| as_i64vec2 | Casts all elements of `self` to `i64`. |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| add-2 | No Documentation 🚧 |
| rem-1 | No Documentation 🚧 |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| add-1 | No Documentation 🚧 |
extend
Creates a 3D vector from
selfand the givenzvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
as_u16vec2
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
saturating_add_signed
Returns a vector containing the saturating addition of
selfand signed vectorrhs. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
as_uvec2
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
u8::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
| min | U8Vec2 | No Documentation 🚧 |
| max | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_ivec2
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
wrapping_add_signed
Returns a vector containing the wrapping addition of
selfand signed vectorrhs. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
as_i8vec2
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [u8; 2] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u8; 2] | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
with_x
Creates a 2D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u8 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec2 | No Documentation 🚧 |
| if_true | U8Vec2 | No Documentation 🚧 |
| if_false | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
as_dvec2
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
as_i16vec2
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
U8Vec3
U8Vec3
- x:u8
- y:u8
- z:u8
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| sub-2 | No Documentation 🚧 |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| add-1 | No Documentation 🚧 |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| sub | No Documentation 🚧 |
| as_vec3 | Casts all elements of `self` to `f32`. |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| clamp | Component-wise clamping of values, similar to [`u8::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| length_squared | Computes the squared length of `self`. |
| as_i64vec3 | Casts all elements of `self` to `i64`. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| rem-2 | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| extend | Creates a 4D vector from `self` and the given `w` value. |
| div-1 | No Documentation 🚧 |
| wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
| splat | Creates a vector with all elements set to `v`. |
| rem | No Documentation 🚧 |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| as_i8vec3 | Casts all elements of `self` to `i8`. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| mul-1 | No Documentation 🚧 |
| as_i16vec3 | Casts all elements of `self` to `i16`. |
| sub-1 | No Documentation 🚧 |
| div-2 | No Documentation 🚧 |
| add | No Documentation 🚧 |
| mul-2 | No Documentation 🚧 |
| add-2 | No Documentation 🚧 |
| new | Creates a new vector. |
| as_dvec3 | Casts all elements of `self` to `f64`. |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| with_y | Creates a 3D vector from `self` with the given value of `y`. |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| to_array | `[x, y, z]` |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| dot | Computes the dot product of `self` and `rhs`. |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| cross | Computes the cross product of `self` and `rhs`. |
| with_z | Creates a 3D vector from `self` with the given value of `z`. |
| from_array | Creates a new vector from an array. |
| as_u64vec3 | Casts all elements of `self` to `u64`. |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| as_ivec3 | Casts all elements of `self` to `i32`. |
| as_vec3a | Casts all elements of `self` to `f32`. |
| mul | No Documentation 🚧 |
| div | No Documentation 🚧 |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| with_x | Creates a 3D vector from `self` with the given value of `x`. |
| as_u16vec3 | Casts all elements of `self` to `u16`. |
| truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
| as_uvec3 | Casts all elements of `self` to `u32`. |
| clone | No Documentation 🚧 |
| rem-1 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
as_vec3
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
u8::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
| min | U8Vec3 | No Documentation 🚧 |
| max | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec3 | No Documentation 🚧 |
| if_true | U8Vec3 | No Documentation 🚧 |
| if_false | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
extend
Creates a 4D vector from
selfand the givenwvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
wrapping_add_signed
Returns a vector containing the wrapping addition of
selfand signed vectorrhs. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u8 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
as_i8vec3
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
as_i16vec3
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u8; 3] | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
cross
Computes the cross product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [u8; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
as_u64vec3
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
as_ivec3
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
saturating_add_signed
Returns a vector containing the saturating addition of
selfand signed vectorrhs. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
as_u16vec3
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
truncate
Creates a 2D vector from the
xandyelements ofself, discardingz. Truncation may also be performed by using [self.xy()][crate::swizzles::Vec3Swizzles::xy()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
as_uvec3
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
U8Vec4
U8Vec4
- x:u8
- y:u8
- z:u8
- w:u8
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| rem-2 | No Documentation 🚧 |
| to_array | `[x, y, z, w]` |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| rem-1 | No Documentation 🚧 |
| as_i64vec4 | Casts all elements of `self` to `i64`. |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| as_i8vec4 | Casts all elements of `self` to `i8`. |
| eq | No Documentation 🚧 |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| with_y | Creates a 4D vector from `self` with the given value of `y`. |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| sub | No Documentation 🚧 |
| rem | No Documentation 🚧 |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| add | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| div-2 | No Documentation 🚧 |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| new | Creates a new vector. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| div-1 | No Documentation 🚧 |
| wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| as_dvec4 | Casts all elements of `self` to `f64`. |
| clamp | Component-wise clamping of values, similar to [`u8::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| div | No Documentation 🚧 |
| mul-1 | No Documentation 🚧 |
| mul-2 | No Documentation 🚧 |
| add-1 | No Documentation 🚧 |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| as_u64vec4 | Casts all elements of `self` to `u64`. |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| as_vec4 | Casts all elements of `self` to `f32`. |
| add-2 | No Documentation 🚧 |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| with_w | Creates a 4D vector from `self` with the given value of `w`. |
| splat | Creates a vector with all elements set to `v`. |
| sub-1 | No Documentation 🚧 |
| truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`U8Vec3`]... |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| with_x | Creates a 4D vector from `self` with the given value of `x`. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| as_i16vec4 | Casts all elements of `self` to `i16`. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| as_uvec4 | Casts all elements of `self` to `u32`. |
| saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| as_ivec4 | Casts all elements of `self` to `i32`. |
| dot | Computes the dot product of `self` and `rhs`. |
| from_array | Creates a new vector from an array. |
| mul | No Documentation 🚧 |
| as_u16vec4 | Casts all elements of `self` to `u16`. |
| length_squared | Computes the squared length of `self`. |
| with_z | Creates a 4D vector from `self` with the given value of `z`. |
| sub-2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u8; 4] | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
as_i64vec4
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
as_i8vec4
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
with_y
Creates a 4D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | u8 | No Documentation 🚧 |
| y | u8 | No Documentation 🚧 |
| z | u8 | No Documentation 🚧 |
| w | u8 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec4 | No Documentation 🚧 |
| if_true | U8Vec4 | No Documentation 🚧 |
| if_false | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
wrapping_add_signed
Returns a vector containing the wrapping addition of
selfand signed vectorrhs. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
as_dvec4
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
u8::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
| min | U8Vec4 | No Documentation 🚧 |
| max | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
as_u64vec4
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
as_vec4
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
with_w
Creates a 4D vector from
selfwith the given value ofw.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u8 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
truncate
Creates a 3D vector from the
x,yandzelements ofself, discardingw. Truncation to [U8Vec3] may also be performed by using [self.xyz()][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
as_i16vec4
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
as_uvec4
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
saturating_add_signed
Returns a vector containing the saturating addition of
selfand signed vectorrhs. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [u8; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
as_u16vec4
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | U8Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u8 | No Documentation 🚧 |
with_z
Creates a 4D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
UVec2
UVec2
- x:u32
- y:u32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates a new vector. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| mul-2 | No Documentation 🚧 |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| dot | Computes the dot product of `self` and `rhs`. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| sub-1 | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| div | No Documentation 🚧 |
| as_dvec2 | Casts all elements of `self` to `f64`. |
| to_array | `[x, y]` |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| as_u8vec2 | Casts all elements of `self` to `u8`. |
| rem-1 | No Documentation 🚧 |
| from_array | Creates a new vector from an array. |
| sub | No Documentation 🚧 |
| add | No Documentation 🚧 |
| clamp | Component-wise clamping of values, similar to [`u32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| sub-2 | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| div-2 | No Documentation 🚧 |
| splat | Creates a vector with all elements set to `v`. |
| add-1 | No Documentation 🚧 |
| as_u16vec2 | Casts all elements of `self` to `u16`. |
| mul-1 | No Documentation 🚧 |
| with_y | Creates a 2D vector from `self` with the given value of `y`. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| add-2 | No Documentation 🚧 |
| as_ivec2 | Casts all elements of `self` to `i32`. |
| div-1 | No Documentation 🚧 |
| as_i16vec2 | Casts all elements of `self` to `i16`. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| as_vec2 | Casts all elements of `self` to `f32`. |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| rem-2 | No Documentation 🚧 |
| as_u64vec2 | Casts all elements of `self` to `u64`. |
| extend | Creates a 3D vector from `self` and the given `z` value. |
| saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
| wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| as_i8vec2 | Casts all elements of `self` to `i8`. |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| with_x | Creates a 2D vector from `self` with the given value of `x`. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| length_squared | Computes the squared length of `self`. |
| rem | No Documentation 🚧 |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| as_i64vec2 | Casts all elements of `self` to `i64`. |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
as_dvec2
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u32; 2] | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec2 | No Documentation 🚧 |
| if_true | UVec2 | No Documentation 🚧 |
| if_false | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
as_u8vec2
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [u32; 2] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
u32::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
| min | UVec2 | No Documentation 🚧 |
| max | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
as_u16vec2
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
as_ivec2
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
as_i16vec2
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
as_vec2
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
extend
Creates a 3D vector from
selfand the givenzvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
saturating_add_signed
Returns a vector containing the saturating addition of
selfand signed vectorrhs. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
wrapping_add_signed
Returns a vector containing the wrapping addition of
selfand signed vectorrhs. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
as_i8vec2
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
with_x
Creates a 2D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
UVec3
UVec3
- x:u32
- y:u32
- z:u32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| sub | No Documentation 🚧 |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| rem-1 | No Documentation 🚧 |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| as_ivec3 | Casts all elements of `self` to `i32`. |
| clamp | Component-wise clamping of values, similar to [`u32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| mul-2 | No Documentation 🚧 |
| cross | Computes the cross product of `self` and `rhs`. |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| with_z | Creates a 3D vector from `self` with the given value of `z`. |
| with_y | Creates a 3D vector from `self` with the given value of `y`. |
| mul-1 | No Documentation 🚧 |
| extend | Creates a 4D vector from `self` and the given `w` value. |
| truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
| as_u8vec3 | Casts all elements of `self` to `u8`. |
| as_vec3a | Casts all elements of `self` to `f32`. |
| div | No Documentation 🚧 |
| sub-1 | No Documentation 🚧 |
| as_u64vec3 | Casts all elements of `self` to `u64`. |
| new | Creates a new vector. |
| as_i16vec3 | Casts all elements of `self` to `i16`. |
| dot | Computes the dot product of `self` and `rhs`. |
| div-2 | No Documentation 🚧 |
| as_vec3 | Casts all elements of `self` to `f32`. |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| rem-2 | No Documentation 🚧 |
| to_array | `[x, y, z]` |
| add-2 | No Documentation 🚧 |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| add | No Documentation 🚧 |
| length_squared | Computes the squared length of `self`. |
| div-1 | No Documentation 🚧 |
| mul | No Documentation 🚧 |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| splat | Creates a vector with all elements set to `v`. |
| with_x | Creates a 3D vector from `self` with the given value of `x`. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| eq | No Documentation 🚧 |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| as_i8vec3 | Casts all elements of `self` to `i8`. |
| clone | No Documentation 🚧 |
| rem | No Documentation 🚧 |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| add-1 | No Documentation 🚧 |
| as_i64vec3 | Casts all elements of `self` to `i64`. |
| wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| as_u16vec3 | Casts all elements of `self` to `u16`. |
| from_array | Creates a new vector from an array. |
| sub-2 | No Documentation 🚧 |
| as_dvec3 | Casts all elements of `self` to `f64`. |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec3 | No Documentation 🚧 |
| if_true | UVec3 | No Documentation 🚧 |
| if_false | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
as_ivec3
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
u32::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
| min | UVec3 | No Documentation 🚧 |
| max | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
cross
Computes the cross product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
with_y
Creates a 3D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
selfand the givenwvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
truncate
Creates a 2D vector from the
xandyelements ofself, discardingz. Truncation may also be performed by using [self.xy()][crate::swizzles::Vec3Swizzles::xy()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
as_u8vec3
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
as_vec3a
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
as_u64vec3
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
as_i16vec3
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
as_vec3
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u32; 3] | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
with_x
Creates a 3D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
as_i8vec3
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
saturating_add_signed
Returns a vector containing the saturating addition of
selfand signed vectorrhs. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
wrapping_add_signed
Returns a vector containing the wrapping addition of
selfand signed vectorrhs. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
as_u16vec3
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [u32; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
UVec4
UVec4
- x:u32
- y:u32
- z:u32
- w:u32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| add-2 | No Documentation 🚧 |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| wrapping_add_signed | Returns a vector containing the wrapping addition of `self` and signed vector `rhs`. In other word... |
| rem-2 | No Documentation 🚧 |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| as_u8vec4 | Casts all elements of `self` to `u8`. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| mul-2 | No Documentation 🚧 |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| wrapping_add | Returns a vector containing the wrapping addition of `self` and `rhs`. In other words this compute... |
| saturating_add_signed | Returns a vector containing the saturating addition of `self` and signed vector `rhs`. In other wo... |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| eq | No Documentation 🚧 |
| new | Creates a new vector. |
| to_array | `[x, y, z, w]` |
| as_u16vec4 | Casts all elements of `self` to `u16`. |
| splat | Creates a vector with all elements set to `v`. |
| from_array | Creates a new vector from an array. |
| wrapping_mul | Returns a vector containing the wrapping multiplication of `self` and `rhs`. In other words this c... |
| sub-1 | No Documentation 🚧 |
| as_u64vec4 | Casts all elements of `self` to `u64`. |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| sub | No Documentation 🚧 |
| length_squared | Computes the squared length of `self`. |
| mul | No Documentation 🚧 |
| saturating_sub | Returns a vector containing the saturating subtraction of `self` and `rhs`. In other words this co... |
| with_y | Creates a 4D vector from `self` with the given value of `y`. |
| dot | Computes the dot product of `self` and `rhs`. |
| div-2 | No Documentation 🚧 |
| rem-1 | No Documentation 🚧 |
| wrapping_div | Returns a vector containing the wrapping division of `self` and `rhs`. In other words this compute... |
| clone | No Documentation 🚧 |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| wrapping_sub | Returns a vector containing the wrapping subtraction of `self` and `rhs`. In other words this comp... |
| as_vec4 | Casts all elements of `self` to `f32`. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| add-1 | No Documentation 🚧 |
| as_dvec4 | Casts all elements of `self` to `f64`. |
| saturating_add | Returns a vector containing the saturating addition of `self` and `rhs`. In other words this compu... |
| clamp | Component-wise clamping of values, similar to [`u32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| div | No Documentation 🚧 |
| truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`UVec3`]... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| saturating_div | Returns a vector containing the saturating division of `self` and `rhs`. In other words this compu... |
| add | No Documentation 🚧 |
| as_ivec4 | Casts all elements of `self` to `i32`. |
| as_i64vec4 | Casts all elements of `self` to `i64`. |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| saturating_mul | Returns a vector containing the saturating multiplication of `self` and `rhs`. In other words this... |
| div-1 | No Documentation 🚧 |
| with_w | Creates a 4D vector from `self` with the given value of `w`. |
| sub-2 | No Documentation 🚧 |
| rem | No Documentation 🚧 |
| as_i16vec4 | Casts all elements of `self` to `i16`. |
| mul-1 | No Documentation 🚧 |
| as_i8vec4 | Casts all elements of `self` to `i8`. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| with_x | Creates a 4D vector from `self` with the given value of `x`. |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| with_z | Creates a 4D vector from `self` with the given value of `z`. |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
wrapping_add_signed
Returns a vector containing the wrapping addition of
selfand signed vectorrhs. In other words this computes[self.x.wrapping_add_signed(rhs.x), self.y.wrapping_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
as_u8vec4
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
wrapping_add
Returns a vector containing the wrapping addition of
selfandrhs. In other words this computes[self.x.wrapping_add(rhs.x), self.y.wrapping_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
saturating_add_signed
Returns a vector containing the saturating addition of
selfand signed vectorrhs. In other words this computes[self.x.saturating_add_signed(rhs.x), self.y.saturating_add_signed(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
new
Creates a new vector.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | u32 | No Documentation 🚧 |
| y | u32 | No Documentation 🚧 |
| z | u32 | No Documentation 🚧 |
| w | u32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u32; 4] | No Documentation 🚧 |
as_u16vec4
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [u32; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
wrapping_mul
Returns a vector containing the wrapping multiplication of
selfandrhs. In other words this computes[self.x.wrapping_mul(rhs.x), self.y.wrapping_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
as_u64vec4
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
length_squared
Computes the squared length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
saturating_sub
Returns a vector containing the saturating subtraction of
selfandrhs. In other words this computes[self.x.saturating_sub(rhs.x), self.y.saturating_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
with_y
Creates a 4D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
wrapping_div
Returns a vector containing the wrapping division of
selfandrhs. In other words this computes[self.x.wrapping_div(rhs.x), self.y.wrapping_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
wrapping_sub
Returns a vector containing the wrapping subtraction of
selfandrhs. In other words this computes[self.x.wrapping_sub(rhs.x), self.y.wrapping_sub(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
as_vec4
Casts all elements of
selftof32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
as_dvec4
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
saturating_add
Returns a vector containing the saturating addition of
selfandrhs. In other words this computes[self.x.saturating_add(rhs.x), self.y.saturating_add(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
u32::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
| min | UVec4 | No Documentation 🚧 |
| max | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
truncate
Creates a 3D vector from the
x,yandzelements ofself, discardingw. Truncation to [UVec3] may also be performed by using [self.xyz()][crate::swizzles::Vec4Swizzles::xyz()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
saturating_div
Returns a vector containing the saturating division of
selfandrhs. In other words this computes[self.x.saturating_div(rhs.x), self.y.saturating_div(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
as_i64vec4
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
saturating_mul
Returns a vector containing the saturating multiplication of
selfandrhs. In other words this computes[self.x.saturating_mul(rhs.x), self.y.saturating_mul(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
selfwith the given value ofw.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
as_i16vec4
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
as_i8vec4
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec4 | No Documentation 🚧 |
| if_true | UVec4 | No Documentation 🚧 |
| if_false | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | UVec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
with_z
Creates a 4D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
Vec2
Vec2
- x:f32
- y:f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| new | Creates a new vector. |
| fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| mul-1 | No Documentation 🚧 |
| with_x | Creates a 2D vector from `self` with the given value of `x`. |
| clamp | Component-wise clamping of values, similar to [`f32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
| reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
| rem | No Documentation 🚧 |
| add | No Documentation 🚧 |
| as_uvec2 | Casts all elements of `self` to `u32`. |
| sub-1 | No Documentation 🚧 |
| is_negative_bitmask | Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. A negat... |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| angle_to | Returns the angle of rotation (in radians) from `self` to `rhs` in the range `[-π, +π]`. The inputs do not need to be unit vectors however they must be non-zero. |
| is_nan | Returns `true` if any elements are `NaN`. |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| div-2 | No Documentation 🚧 |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
| is_nan_mask | Performs `is_nan` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_nan(), y.is_nan(), ...]... |
| perp | Returns a vector that is equal to `self` rotated by 90 degrees. |
| div | No Documentation 🚧 |
| sub | No Documentation 🚧 |
| as_u16vec2 | Casts all elements of `self` to `u16`. |
| clone | No Documentation 🚧 |
| powf | Returns a vector containing each element of `self` raised to the power of `n`. |
| neg | No Documentation 🚧 |
| as_i16vec2 | Casts all elements of `self` to `i16`. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| sub-2 | No Documentation 🚧 |
| project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
| from_angle | Creates a 2D vector containing `[angle.cos(), angle.sin()]`. This can be used in conjunction with the [`rotate()`]... |
| signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
| length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
| midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
| clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
| copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
| is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
| clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
| dot | Computes the dot product of `self` and `rhs`. |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
| move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| as_i64vec2 | Casts all elements of `self` to `i64`. |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| rotate | Returns `rhs` rotated by the angle of `self`. If `self` is normalized, then this just rotation. Th... |
| refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
| is_finite_mask | Performs `is_finite` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_finite(), y.is_finite(), ...]... |
| splat | Creates a vector with all elements set to `v`. |
| recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| as_u8vec2 | Casts all elements of `self` to `u8`. |
| extend | Creates a 3D vector from `self` and the given `z` value. |
| length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
| add-2 | No Documentation 🚧 |
| exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
| with_y | Creates a 2D vector from `self` with the given value of `y`. |
| add-1 | No Documentation 🚧 |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
| mul | No Documentation 🚧 |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| from_array | Creates a new vector from an array. |
| to_angle | Returns the angle (in radians) of this vector in the range `[-π, +π]`. The input does not need to be a unit vector however it must be non-zero. |
| mul-2 | No Documentation 🚧 |
| length | Computes the length of `self`. |
| distance | Computes the Euclidean distance between two points in space. |
| project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
| as_u64vec2 | Casts all elements of `self` to `u64`. |
| mul_add | Fused multiply-add. Computes `(self * a) + b` element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Using `mul_add` *may* be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind. |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
| as_ivec2 | Casts all elements of `self` to `i32`. |
| rem-1 | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| rotate_towards | Rotates towards `rhs` up to `max_angle` (in radians). When `max_angle` is `0.0`, the result will b... |
| normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
| perp_dot | The perpendicular dot product of `self` and `rhs`. Also known as the wedge product, 2D cross produ... |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
| round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
| fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
| lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
| rem-2 | No Documentation 🚧 |
| div-1 | No Documentation 🚧 |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
| normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
| as_dvec2 | Casts all elements of `self` to `f64`. |
| angle_between | No Documentation 🚧 |
| as_i8vec2 | Casts all elements of `self` to `i8`. |
| to_array | `[x, y]` |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc(). Note that this differs from the GLSL implementation offractwhich returnsself - self.floor(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
reject_from
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be of non-zero length.Panics
Will panic if
rhshas a length of zero whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
with_x
Creates a 2D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
f32::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
| min | Vec2 | No Documentation 🚧 |
| max | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self. This means numbers are always truncated towards zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
reflect
Returns the reflection vector for a given incident vector
selfand surface normalnormal.normalmust be normalized.Panics
Will panic if
normalis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
as_uvec2
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec2 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec2 | No Documentation 🚧 |
| if_true | Vec2 | No Documentation 🚧 |
| if_false | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
angle_to
Returns the angle of rotation (in radians) from
selftorhsin the range[-π, +π]. The inputs do not need to be unit vectors however they must be non-zero.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
reject_from_normalized
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
is_nan_mask
Performs
is_nanon each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
perp
Returns a vector that is equal to
selfrotated by 90 degrees.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
as_u16vec2
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
powf
Returns a vector containing each element of
selfraised to the power ofn.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
as_i16vec2
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec2 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
project_onto
Returns the vector projection of
selfontorhs.rhsmust be of non-zero length.Panics
Will panic if
rhsis zero length whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
from_angle
Creates a 2D vector containing
[angle.cos(), angle.sin()]. This can be used in conjunction with the [rotate()][Self::rotate()] method, e.g.Vec2::from_angle(PI).rotate(Vec2::Y)will create the vector[-1, 0]and rotate [Vec2::Y] around it returning-Vec2::Y.
Arguments
| Name | Type | Documentation |
|---|---|---|
| angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
1.0if the number is positive,+0.0orINFINITY-1.0if the number is negative,-0.0orNEG_INFINITYNANif the number isNAN
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
length_squared
Computes the squared length of
self. This is faster thanlength()as it avoids a square root operation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
midpoint
Calculates the midpoint between
selfandrhs. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)should yield the same result asa.lerp(b, 0.5)while being slightly cheaper to compute.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
clamp_length_max
Returns a vector with a length no more than
max.Panics
Will panic if
maxis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhsand the magnitudes ofself.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
is_normalized
Returns whether
selfis length1.0or not. Uses a precision threshold of approximately1e-4.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clamp_length_min
Returns a vector with a length no less than
min.Panics
Will panic if
minis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
move_towards
Moves towards
rhsbased on the valued. Whendis0.0, the result will be equal toself. Whendis equal toself.distance(rhs), the result will be equal torhs. Will not go pastrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
as_i64vec2
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec2 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
rotate
Returns
rhsrotated by the angle ofself. Ifselfis normalized, then this just rotation. This is what you usually want. Otherwise, it will be like a rotation with a multiplication byself's length.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
refract
Returns the refraction direction for a given incident vector
self, surface normalnormaland ratio of indices of refraction,eta. When total internal reflection occurs, a zero vector will be returned.selfandnormalmust be normalized.Panics
Will panic if
selfornormalis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
| normal | Vec2 | No Documentation 🚧 |
| eta | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
is_finite_mask
Performs
is_finiteon each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/nof each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
as_u8vec2
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec2 | No Documentation 🚧 |
extend
Creates a 3D vector from
selfand the givenzvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
length_recip
Computes
1.0 / length(). For valid results,selfmust not be of length zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
exp
Returns a vector containing
e^self(the exponential function) for each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
with_y
Creates a 2D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
| rhs | Vec2 | No Documentation 🚧 |
| max_abs_diff | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec2 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [f32; 2] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
to_angle
Returns the angle (in radians) of this vector in the range
[-π, +π]. The input does not need to be a unit vector however it must be non-zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
length
Computes the length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
project_onto_normalized
Returns the vector projection of
selfontorhs.rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
as_u64vec2
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec2 | No Documentation 🚧 |
mul_add
Fused multiply-add. Computes
(self * a) + belement-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_addmay be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
normalize
Returns
selfnormalized to length 1.0. For valid results,selfmust be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()] and [Self::normalize_or_zero()]. Panics Will panic if the resulting normalized vector is not finite whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
as_ivec2
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec2 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
rotate_towards
Rotates towards
rhsup tomax_angle(in radians). Whenmax_angleis0.0, the result will be equal toself. Whenmax_angleis equal toself.angle_between(rhs), the result will be equal torhs. Ifmax_angleis negative, rotates towards the exact opposite ofrhs. Will not go past the target.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
| rhs | Vec2 | No Documentation 🚧 |
| max_angle | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
normalize_or_zero
Returns
selfnormalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
perp_dot
The perpendicular dot product of
selfandrhs. Also known as the wedge product, 2D cross product, and determinant.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs. [Euclidean division]: f32::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
round
Returns a vector containing the nearest integer to a number for each element of
self. Round half-way cases away from 0.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor(). Note that this differs from the Rust implementation offractwhich returnsself - self.trunc(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
lerp
Performs a linear interpolation between
selfandrhsbased on the values. Whensis0.0, the result will be equal toself. Whensis1.0, the result will be equal torhs. Whensis outside of range[0, 1], the result is linearly extrapolated.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
clamp_length
Returns a vector with a length no less than
minand no more thanmax.Panics
Will panic if
minis greater thanmax, or if eitherminormaxis negative, whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
normalize_or
Returns
selfnormalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
as_dvec2
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec2 | No Documentation 🚧 |
angle_between
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
as_i8vec2
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec2 | No Documentation 🚧 |
to_array
[x, y]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec2 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f32; 2] | No Documentation 🚧 |
Vec3
Vec3
- x:f32
- y:f32
- z:f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| as_i16vec3 | Casts all elements of `self` to `i16`. |
| clamp | Component-wise clamping of values, similar to [`f32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| neg | No Documentation 🚧 |
| clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
| project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
| clone | No Documentation 🚧 |
| normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
| reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
| mul | No Documentation 🚧 |
| round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
| length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| as_ivec3 | Casts all elements of `self` to `i32`. |
| floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
| clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
| as_i64vec3 | Casts all elements of `self` to `i64`. |
| with_z | Creates a 3D vector from `self` with the given value of `z`. |
| eq | No Documentation 🚧 |
| with_x | Creates a 3D vector from `self` with the given value of `x`. |
| copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
| normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
| powf | Returns a vector containing each element of `self` raised to the power of `n`. |
| splat | Creates a vector with all elements set to `v`. |
| rem | No Documentation 🚧 |
| rem-2 | No Documentation 🚧 |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
| refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
| signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
| normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
| extend | Creates a 4D vector from `self` and the given `w` value. |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| new | Creates a new vector. |
| as_u8vec3 | Casts all elements of `self` to `u8`. |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
| recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
| angle_between | Returns the angle (in radians) between two vectors in the range `[0, +π]`. The inputs do not need to be unit vectors however they must be non-zero. |
| add-1 | No Documentation 🚧 |
| is_nan_mask | Performs `is_nan` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_nan(), y.is_nan(), ...]... |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| sub-2 | No Documentation 🚧 |
| is_negative_bitmask | Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. A negat... |
| clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
| from_array | Creates a new vector from an array. |
| ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
| length | Computes the length of `self`. |
| reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| as_i8vec3 | Casts all elements of `self` to `i8`. |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| is_finite_mask | Performs `is_finite` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_finite(), y.is_finite(), ...]... |
| lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
| div | No Documentation 🚧 |
| dot | Computes the dot product of `self` and `rhs`. |
| with_y | Creates a 3D vector from `self` with the given value of `y`. |
| project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
| as_dvec3 | Casts all elements of `self` to `f64`. |
| as_uvec3 | Casts all elements of `self` to `u32`. |
| is_nan | Returns `true` if any elements are `NaN`. |
| as_u64vec3 | Casts all elements of `self` to `u64`. |
| div-2 | No Documentation 🚧 |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| as_u16vec3 | Casts all elements of `self` to `u16`. |
| mul-1 | No Documentation 🚧 |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| cross | Computes the cross product of `self` and `rhs`. |
| distance | Computes the Euclidean distance between two points in space. |
| add | No Documentation 🚧 |
| fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
| midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
| any_orthogonal_vector | Returns some vector that is orthogonal to the given one. The input vector must be finite and non-z... |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| sub-1 | No Documentation 🚧 |
| truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
| to_array | `[x, y, z]` |
| mul-2 | No Documentation 🚧 |
| move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| add-2 | No Documentation 🚧 |
| length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
| mul_add | Fused multiply-add. Computes `(self * a) + b` element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Using `mul_add` *may* be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind. |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| sub | No Documentation 🚧 |
| rem-1 | No Documentation 🚧 |
| any_orthonormal_vector | Returns any unit vector that is orthogonal to the given one. The input vector must be unit length.... |
| div-1 | No Documentation 🚧 |
as_i16vec3
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
f32::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
| min | Vec3 | No Documentation 🚧 |
| max | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
clamp_length_max
Returns a vector with a length no more than
max.Panics
Will panic if
maxis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
is_normalized
Returns whether
selfis length1.0or not. Uses a precision threshold of approximately1e-4.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
project_onto
Returns the vector projection of
selfontorhs.rhsmust be of non-zero length.Panics
Will panic if
rhsis zero length whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
normalize
Returns
selfnormalized to length 1.0. For valid results,selfmust be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()] and [Self::normalize_or_zero()]. Panics Will panic if the resulting normalized vector is not finite whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
reflect
Returns the reflection vector for a given incident vector
selfand surface normalnormal.normalmust be normalized.Panics
Will panic if
normalis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
round
Returns a vector containing the nearest integer to a number for each element of
self. Round half-way cases away from 0.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self. This is faster thanlength()as it avoids a square root operation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
reject_from
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be of non-zero length.Panics
Will panic if
rhshas a length of zero whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
as_ivec3
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
clamp_length
Returns a vector with a length no less than
minand no more thanmax.Panics
Will panic if
minis greater thanmax, or if eitherminormaxis negative, whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
as_i64vec3
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
with_z
Creates a 3D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
with_x
Creates a 3D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhsand the magnitudes ofself.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
normalize_or_zero
Returns
selfnormalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
powf
Returns a vector containing each element of
selfraised to the power ofn.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
| rhs | Vec3 | No Documentation 🚧 |
| max_abs_diff | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
exp
Returns a vector containing
e^self(the exponential function) for each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
refract
Returns the refraction direction for a given incident vector
self, surface normalnormaland ratio of indices of refraction,eta. When total internal reflection occurs, a zero vector will be returned.selfandnormalmust be normalized.Panics
Will panic if
selfornormalis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
| normal | Vec3 | No Documentation 🚧 |
| eta | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
1.0if the number is positive,+0.0orINFINITY-1.0if the number is negative,-0.0orNEG_INFINITYNANif the number isNAN
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
normalize_or
Returns
selfnormalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs. [Euclidean division]: f32::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
extend
Creates a 4D vector from
selfand the givenwvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
as_u8vec3
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/nof each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
angle_between
Returns the angle (in radians) between two vectors in the range
[0, +π]. The inputs do not need to be unit vectors however they must be non-zero.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
is_nan_mask
Performs
is_nanon each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
clamp_length_min
Returns a vector with a length no less than
min.Panics
Will panic if
minis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [f32; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
length
Computes the length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
reject_from_normalized
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor(). Note that this differs from the Rust implementation offractwhich returnsself - self.trunc(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
as_i8vec3
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
is_finite_mask
Performs
is_finiteon each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
lerp
Performs a linear interpolation between
selfandrhsbased on the values. Whensis0.0, the result will be equal toself. Whensis1.0, the result will be equal torhs. Whensis outside of range[0, 1], the result is linearly extrapolated.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self. This means numbers are always truncated towards zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
with_y
Creates a 3D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
project_onto_normalized
Returns the vector projection of
selfontorhs.rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
as_dvec3
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
as_uvec3
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_u64vec3
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
as_u16vec3
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
cross
Computes the cross product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc(). Note that this differs from the GLSL implementation offractwhich returnsself - self.floor(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
midpoint
Calculates the midpoint between
selfandrhs. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)should yield the same result asa.lerp(b, 0.5)while being slightly cheaper to compute.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
any_orthogonal_vector
Returns some vector that is orthogonal to the given one. The input vector must be finite and non-zero. The output vector is not necessarily unit length. For that use [
Self::any_orthonormal_vector()] instead.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3 | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
truncate
Creates a 2D vector from the
xandyelements ofself, discardingz. Truncation may also be performed by using [self.xy()][crate::swizzles::Vec3Swizzles::xy()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f32; 3] | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
move_towards
Moves towards
rhsbased on the valued. Whendis0.0, the result will be equal toself. Whendis equal toself.distance(rhs), the result will be equal torhs. Will not go pastrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
length_recip
Computes
1.0 / length(). For valid results,selfmust not be of length zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
mul_add
Fused multiply-add. Computes
(self * a) + belement-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_addmay be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec3 | No Documentation 🚧 |
| if_true | Vec3 | No Documentation 🚧 |
| if_false | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
any_orthonormal_vector
Returns any unit vector that is orthogonal to the given one. The input vector must be unit length.
Panics
Will panic if
selfis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
Vec3A
Vec3A
- x:f32
- y:f32
- z:f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
| as_u8vec3 | Casts all elements of `self` to `u8`. |
| lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
| div | No Documentation 🚧 |
| rem | No Documentation 🚧 |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
| is_negative_bitmask | Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. A negat... |
| normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
| normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| splat | Creates a vector with all elements set to `v`. |
| rem-2 | No Documentation 🚧 |
| exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
| midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
| sub-2 | No Documentation 🚧 |
| neg | No Documentation 🚧 |
| move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
| mul | No Documentation 🚧 |
| project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
| rem-1 | No Documentation 🚧 |
| clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
| normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
| sub-1 | No Documentation 🚧 |
| div-2 | No Documentation 🚧 |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| mul-1 | No Documentation 🚧 |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
| reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
| add-2 | No Documentation 🚧 |
| is_finite_mask | Performs `is_finite` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_finite(), y.is_finite(), ...]... |
| add-1 | No Documentation 🚧 |
| clamp | Component-wise clamping of values, similar to [`f32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| powf | Returns a vector containing each element of `self` raised to the power of `n`. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| eq | No Documentation 🚧 |
| reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
| as_uvec3 | Casts all elements of `self` to `u32`. |
| new | Creates a new vector. |
| to_array | `[x, y, z]` |
| with_y | Creates a 3D vector from `self` with the given value of `y`. |
| fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
| trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| dot | Computes the dot product of `self` and `rhs`. |
| is_nan | Returns `true` if any elements are `NaN`. |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
| clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
| ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
| is_nan_mask | Performs `is_nan` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_nan(), y.is_nan(), ...]... |
| truncate | Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. Truncation may also b... |
| clone | No Documentation 🚧 |
| as_i64vec3 | Casts all elements of `self` to `i64`. |
| mul-2 | No Documentation 🚧 |
| signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
| mul_add | Fused multiply-add. Computes `(self * a) + b` element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Using `mul_add` *may* be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind. |
| as_i16vec3 | Casts all elements of `self` to `i16`. |
| as_i8vec3 | Casts all elements of `self` to `i8`. |
| as_u16vec3 | Casts all elements of `self` to `u16`. |
| any_orthogonal_vector | Returns some vector that is orthogonal to the given one. The input vector must be finite and non-z... |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
| floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
| clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| div-1 | No Documentation 🚧 |
| as_ivec3 | Casts all elements of `self` to `i32`. |
| angle_between | Returns the angle (in radians) between two vectors in the range `[0, +π]`. The inputs do not need to be unit vectors however they must be non-zero. |
| as_dvec3 | Casts all elements of `self` to `f64`. |
| round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
| from_array | Creates a new vector from an array. |
| refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
| sub | No Documentation 🚧 |
| from_vec4 | Creates a [`Vec3A`] from the `x`, `y` and `z` elements of `self` discarding `w`. On architectures where SIMD is supported such as SSE2 on `x86_64` this conversion is a noop. |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
| length | Computes the length of `self`. |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| extend | Creates a 4D vector from `self` and the given `w` value. |
| fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
| with_z | Creates a 3D vector from `self` with the given value of `z`. |
| distance | Computes the Euclidean distance between two points in space. |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| cross | Computes the cross product of `self` and `rhs`. |
| any_orthonormal_vector | Returns any unit vector that is orthogonal to the given one. The input vector must be unit length.... |
| with_x | Creates a 3D vector from `self` with the given value of `x`. |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| as_u64vec3 | Casts all elements of `self` to `u64`. |
| add | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3A | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
length_squared
Computes the squared length of
self. This is faster thanlength()as it avoids a square root operation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
as_u8vec3
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec3 | No Documentation 🚧 |
lerp
Performs a linear interpolation between
selfandrhsbased on the values. Whensis0.0, the result will be equal toself. Whensis1.0, the result will be equal torhs. Whensis outside of range[0, 1], the result is linearly extrapolated.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
| rhs | Vec3A | No Documentation 🚧 |
| s | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
normalize
Returns
selfnormalized to length 1.0. For valid results,selfmust be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()] and [Self::normalize_or_zero()]. Panics Will panic if the resulting normalized vector is not finite whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
normalize_or_zero
Returns
selfnormalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3A | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
exp
Returns a vector containing
e^self(the exponential function) for each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
midpoint
Calculates the midpoint between
selfandrhs. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)should yield the same result asa.lerp(b, 0.5)while being slightly cheaper to compute.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
move_towards
Moves towards
rhsbased on the valued. Whendis0.0, the result will be equal toself. Whendis equal toself.distance(rhs), the result will be equal torhs. Will not go pastrhs.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
| rhs | Vec3A | No Documentation 🚧 |
| d | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
project_onto
Returns the vector projection of
selfontorhs.rhsmust be of non-zero length.Panics
Will panic if
rhsis zero length whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
clamp_length_min
Returns a vector with a length no less than
min.Panics
Will panic if
minis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
normalize_or
Returns
selfnormalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3A | No Documentation 🚧 |
project_onto_normalized
Returns the vector projection of
selfontorhs.rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3A | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhsand the magnitudes ofself.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
reject_from
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be of non-zero length.Panics
Will panic if
rhshas a length of zero whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
is_normalized
Returns whether
selfis length1.0or not. Uses a precision threshold of approximately1e-4.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
is_finite_mask
Performs
is_finiteon each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3A | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
f32::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
| min | Vec3A | No Documentation 🚧 |
| max | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
reflect
Returns the reflection vector for a given incident vector
selfand surface normalnormal.normalmust be normalized.Panics
Will panic if
normalis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3A | No Documentation 🚧 |
powf
Returns a vector containing each element of
selfraised to the power ofn.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
reject_from_normalized
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/nof each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
as_uvec3
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec3 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
to_array
[x, y, z]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f32; 3] | No Documentation 🚧 |
with_y
Creates a 3D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc(). Note that this differs from the GLSL implementation offractwhich returnsself - self.floor(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self. This means numbers are always truncated towards zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
clamp_length_max
Returns a vector with a length no more than
max.Panics
Will panic if
maxis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
is_nan_mask
Performs
is_nanon each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3A | No Documentation 🚧 |
truncate
Creates a 2D vector from the
xandyelements ofself, discardingz. Truncation may also be performed by using [self.xy()][crate::swizzles::Vec3Swizzles::xy()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec2 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
as_i64vec3
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec3 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
1.0if the number is positive,+0.0orINFINITY-1.0if the number is negative,-0.0orNEG_INFINITYNANif the number isNAN
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
mul_add
Fused multiply-add. Computes
(self * a) + belement-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_addmay be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
| a | Vec3A | No Documentation 🚧 |
| b | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
as_i16vec3
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec3 | No Documentation 🚧 |
as_i8vec3
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec3 | No Documentation 🚧 |
as_u16vec3
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec3 | No Documentation 🚧 |
any_orthogonal_vector
Returns some vector that is orthogonal to the given one. The input vector must be finite and non-zero. The output vector is not necessarily unit length. For that use [
Self::any_orthonormal_vector()] instead.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
| rhs | Vec3A | No Documentation 🚧 |
| max_abs_diff | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
length_recip
Computes
1.0 / length(). For valid results,selfmust not be of length zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
clamp_length
Returns a vector with a length no less than
minand no more thanmax.Panics
Will panic if
minis greater thanmax, or if eitherminormaxis negative, whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
| min | f32 | No Documentation 🚧 |
| max | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec3A | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
as_ivec3
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec3 | No Documentation 🚧 |
angle_between
Returns the angle (in radians) between two vectors in the range
[0, +π]. The inputs do not need to be unit vectors however they must be non-zero.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
as_dvec3
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec3 | No Documentation 🚧 |
round
Returns a vector containing the nearest integer to a number for each element of
self. Round half-way cases away from 0.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [f32; 3] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
refract
Returns the refraction direction for a given incident vector
self, surface normalnormaland ratio of indices of refraction,eta. When total internal reflection occurs, a zero vector will be returned.selfandnormalmust be normalized.Panics
Will panic if
selfornormalis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
| normal | Vec3A | No Documentation 🚧 |
| eta | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
from_vec4
Creates a [
Vec3A] from thex,yandzelements ofselfdiscardingw. On architectures where SIMD is supported such as SSE2 onx86_64this conversion is a noop.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs. [Euclidean division]: f32::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
length
Computes the length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
extend
Creates a 4D vector from
selfand the givenwvalue.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor(). Note that this differs from the Rust implementation offractwhich returnsself - self.trunc(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
with_z
Creates a 3D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec3A | No Documentation 🚧 |
| if_true | Vec3A | No Documentation 🚧 |
| if_false | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
cross
Computes the cross product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
any_orthonormal_vector
Returns any unit vector that is orthogonal to the given one. The input vector must be unit length.
Panics
Will panic if
selfis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
with_x
Creates a 3D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
as_u64vec3
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec3A | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec3 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3A | No Documentation 🚧 |
Vec4
Vec4
- x:f32
- y:f32
- z:f32
- w:f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| refract | Returns the refraction direction for a given incident vector `self`, surface normal `normal` and r... |
| rem_euclid | Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. [Euclidean division... |
| rem-2 | No Documentation 🚧 |
| fract_gl | Returns a vector containing the fractional part of the vector as `self - self.floor()`. Note that ... |
| add-2 | No Documentation 🚧 |
| move_towards | Moves towards `rhs` based on the value `d`. When `d` is `0.0`, the result will be equal to `self`.... |
| is_finite | Returns `true` if, and only if, all elements are finite. If any element is either `NaN`, positive... |
| sub-1 | No Documentation 🚧 |
| with_x | Creates a 4D vector from `self` with the given value of `x`. |
| clamp_length | Returns a vector with a length no less than `min` and no more than `max`. # Panics Will panic if `min`... |
| as_u16vec4 | Casts all elements of `self` to `u16`. |
| as_dvec4 | Casts all elements of `self` to `f64`. |
| is_nan_mask | Performs `is_nan` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_nan(), y.is_nan(), ...]... |
| to_array | `[x, y, z, w]` |
| cmpge | Returns a vector mask containing the result of a `>=` comparison for each element of `self` and `rhs`... |
| max | Returns a vector containing the maximum values for each element of `self` and `rhs`. In other word... |
| abs_diff_eq | Returns true if the absolute difference of all elements between `self` and `rhs` is less than or e... |
| abs | Returns a vector containing the absolute value of each element of `self`. |
| trunc | Returns a vector containing the integer part each element of `self`. This means numbers are always... |
| add | No Documentation 🚧 |
| midpoint | Calculates the midpoint between `self` and `rhs`. The midpoint is the average of, or halfway point... |
| neg | No Documentation 🚧 |
| sub | No Documentation 🚧 |
| is_negative_bitmask | Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. A negat... |
| element_sum | Returns the sum of all elements of `self`. In other words, this computes `self.x + self.y + ..`. |
| clamp_length_min | Returns a vector with a length no less than `min`. # Panics Will panic if `min` is negative when `glam_assert` is enabled. |
| eq | No Documentation 🚧 |
| as_i16vec4 | Casts all elements of `self` to `i16`. |
| splat | Creates a vector with all elements set to `v`. |
| dot | Computes the dot product of `self` and `rhs`. |
| element_product | Returns the product of all elements of `self`. In other words, this computes `self.x * self.y * ..... |
| rem-1 | No Documentation 🚧 |
| new | Creates a new vector. |
| div_euclid | Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. |
| copysign | Returns a vector with signs of `rhs` and the magnitudes of `self`. |
| div-1 | No Documentation 🚧 |
| from_array | Creates a new vector from an array. |
| floor | Returns a vector containing the largest integer less than or equal to a number for each element of... |
| as_i8vec4 | Casts all elements of `self` to `i8`. |
| as_ivec4 | Casts all elements of `self` to `i32`. |
| distance_squared | Compute the squared euclidean distance between two points in space. |
| mul-2 | No Documentation 🚧 |
| div | No Documentation 🚧 |
| cmpne | Returns a vector mask containing the result of a `!=` comparison for each element of `self` and `rhs`... |
| with_y | Creates a 4D vector from `self` with the given value of `y`. |
| rem | No Documentation 🚧 |
| cmplt | Returns a vector mask containing the result of a `<` comparison for each element of `self` and `rhs`... |
| as_u8vec4 | Casts all elements of `self` to `u8`. |
| is_finite_mask | Performs `is_finite` on each element of self, returning a vector mask of the results. In other words, this computes `[x.is_finite(), y.is_finite(), ...]... |
| as_u64vec4 | Casts all elements of `self` to `u64`. |
| is_nan | Returns `true` if any elements are `NaN`. |
| normalize_or_zero | Returns `self` normalized to length 1.0 if possible, else returns zero. In particular, if the inpu... |
| length | Computes the length of `self`. |
| reject_from | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| reject_from_normalized | Returns the vector rejection of `self` from `rhs`. The vector rejection is the vector perpendicula... |
| length_recip | Computes `1.0 / length()`. For valid results, `self` must _not_ be of length zero. |
| sub-2 | No Documentation 🚧 |
| clamp_length_max | Returns a vector with a length no more than `max`. # Panics Will panic if `max` is negative when `glam_assert` is enabled. |
| ceil | Returns a vector containing the smallest integer greater than or equal to a number for each elemen... |
| clamp | Component-wise clamping of values, similar to [`f32::clamp`]. Each element in `min` must be less-or-equal to the corresponding element in `max`. # Panics Will panic if `min` is greater than `max` when `glam_assert` is enabled. |
| div-2 | No Documentation 🚧 |
| distance | Computes the Euclidean distance between two points in space. |
| lerp | Performs a linear interpolation between `self` and `rhs` based on the value `s`. When `s` is `0.0`... |
| project_onto_normalized | Returns the vector projection of `self` onto `rhs`. `rhs` must be normalized. # Panics Will pani... |
| powf | Returns a vector containing each element of `self` raised to the power of `n`. |
| exp | Returns a vector containing `e^self` (the exponential function) for each element of `self`. |
| truncate | Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. Truncation to [`Vec3`]... |
| length_squared | Computes the squared length of `self`. This is faster than `length()` as it avoids a square root o... |
| dot_into_vec | Returns a vector where every component is the dot product of `self` and `rhs`. |
| round | Returns a vector containing the nearest integer to a number for each element of `self`. Round half... |
| max_element | Returns the horizontal maximum of `self`. In other words this computes `max(x, y, ..)`. |
| min_element | Returns the horizontal minimum of `self`. In other words this computes `min(x, y, ..)`. |
| mul | No Documentation 🚧 |
| cmpeq | Returns a vector mask containing the result of a `==` comparison for each element of `self` and `rhs`... |
| reflect | Returns the reflection vector for a given incident vector `self` and surface normal `normal`. `normal`... |
| with_z | Creates a 4D vector from `self` with the given value of `z`. |
| as_uvec4 | Casts all elements of `self` to `u32`. |
| project_onto | Returns the vector projection of `self` onto `rhs`. `rhs` must be of non-zero length. # Panics W... |
| signum | Returns a vector with elements representing the sign of `self`. - `1.0` if the number is positive,... |
| clone | No Documentation 🚧 |
| add-1 | No Documentation 🚧 |
| as_i64vec4 | Casts all elements of `self` to `i64`. |
| with_w | Creates a 4D vector from `self` with the given value of `w`. |
| cmple | Returns a vector mask containing the result of a `<=` comparison for each element of `self` and `rhs`... |
| fract | Returns a vector containing the fractional part of the vector as `self - self.trunc()`. Note that ... |
| recip | Returns a vector containing the reciprocal `1.0/n` of each element of `self`. |
| mul_add | Fused multiply-add. Computes `(self * a) + b` element-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Using `mul_add` *may* be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind. |
| normalize | Returns `self` normalized to length 1.0. For valid results, `self` must be finite and _not_ of len... |
| is_normalized | Returns whether `self` is length `1.0` or not. Uses a precision threshold of approximately `1e-4`. |
| cmpgt | Returns a vector mask containing the result of a `>` comparison for each element of `self` and `rhs`... |
| select | Creates a vector from the elements in `if_true` and `if_false`, selecting which to use for each el... |
| normalize_or | Returns `self` normalized to length 1.0 if possible, else returns a fallback value. In particular... |
| min | Returns a vector containing the minimum values for each element of `self` and `rhs`. In other word... |
| mul-1 | No Documentation 🚧 |
refract
Returns the refraction direction for a given incident vector
self, surface normalnormaland ratio of indices of refraction,eta. When total internal reflection occurs, a zero vector will be returned.selfandnormalmust be normalized.Panics
Will panic if
selfornormalis not normalized whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
| normal | Vec4 | No Documentation 🚧 |
| eta | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
rem_euclid
Returns the element-wise remainder of [Euclidean division] of
selfbyrhs. [Euclidean division]: f32::rem_euclid
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
rem-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
fract_gl
Returns a vector containing the fractional part of the vector as
self - self.floor(). Note that this differs from the Rust implementation offractwhich returnsself - self.trunc(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
add-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
move_towards
Moves towards
rhsbased on the valued. Whendis0.0, the result will be equal toself. Whendis equal toself.distance(rhs), the result will be equal torhs. Will not go pastrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
is_finite
Returns
trueif, and only if, all elements are finite. If any element is eitherNaN, positive or negative infinity, this will returnfalse.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
sub-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
with_x
Creates a 4D vector from
selfwith the given value ofx.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
clamp_length
Returns a vector with a length no less than
minand no more thanmax.Panics
Will panic if
minis greater thanmax, or if eitherminormaxis negative, whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
as_u16vec4
Casts all elements of
selftou16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U16Vec4 | No Documentation 🚧 |
as_dvec4
Casts all elements of
selftof64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | DVec4 | No Documentation 🚧 |
is_nan_mask
Performs
is_nanon each element of self, returning a vector mask of the results. In other words, this computes[x.is_nan(), y.is_nan(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4A | No Documentation 🚧 |
to_array
[x, y, z, w]
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [f32; 4] | No Documentation 🚧 |
cmpge
Returns a vector mask containing the result of a
>=comparison for each element ofselfandrhs. In other words this computes[self.x >= rhs.x, self.y >= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4A | No Documentation 🚧 |
max
Returns a vector containing the maximum values for each element of
selfandrhs. In other words this computes[self.x.max(rhs.x), self.y.max(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
abs_diff_eq
Returns true if the absolute difference of all elements between
selfandrhsis less than or equal tomax_abs_diff. This can be used to compare if two vectors contain similar elements. It works best when comparing with a known value. Themax_abs_diffthat should be used used depends on the values being compared against. For more see comparing floating point numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
| rhs | Vec4 | No Documentation 🚧 |
| max_abs_diff | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
abs
Returns a vector containing the absolute value of each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
trunc
Returns a vector containing the integer part each element of
self. This means numbers are always truncated towards zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
add
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
midpoint
Calculates the midpoint between
selfandrhs. The midpoint is the average of, or halfway point between, two vectors.a.midpoint(b)should yield the same result asa.lerp(b, 0.5)while being slightly cheaper to compute.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
neg
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
sub
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
is_negative_bitmask
Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of
self. A negative element results in a1bit and a positive element in a0bit. Elementxgoes into the first lowest bit, elementyinto the second, etc.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u32 | No Documentation 🚧 |
element_sum
Returns the sum of all elements of
self. In other words, this computesself.x + self.y + ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
clamp_length_min
Returns a vector with a length no less than
min.Panics
Will panic if
minis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
as_i16vec4
Casts all elements of
selftoi16.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I16Vec4 | No Documentation 🚧 |
splat
Creates a vector with all elements set to
v.
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
dot
Computes the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
element_product
Returns the product of all elements of
self. In other words, this computesself.x * self.y * ...
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
rem-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
new
Creates a new vector.
Arguments
| Name | Type | Documentation |
|---|---|---|
| x | f32 | No Documentation 🚧 |
| y | f32 | No Documentation 🚧 |
| z | f32 | No Documentation 🚧 |
| w | f32 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
div_euclid
Returns the element-wise quotient of [Euclidean division] of
selfbyrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
copysign
Returns a vector with signs of
rhsand the magnitudes ofself.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
div-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
from_array
Creates a new vector from an array.
Arguments
| Name | Type | Documentation |
|---|---|---|
| a | [f32; 4] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
floor
Returns a vector containing the largest integer less than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
as_i8vec4
Casts all elements of
selftoi8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I8Vec4 | No Documentation 🚧 |
as_ivec4
Casts all elements of
selftoi32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | IVec4 | No Documentation 🚧 |
distance_squared
Compute the squared euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
mul-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
div
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
cmpne
Returns a vector mask containing the result of a
!=comparison for each element ofselfandrhs. In other words this computes[self.x != rhs.x, self.y != rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4A | No Documentation 🚧 |
with_y
Creates a 4D vector from
selfwith the given value ofy.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
rem
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
cmplt
Returns a vector mask containing the result of a
<comparison for each element ofselfandrhs. In other words this computes[self.x < rhs.x, self.y < rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4A | No Documentation 🚧 |
as_u8vec4
Casts all elements of
selftou8.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U8Vec4 | No Documentation 🚧 |
is_finite_mask
Performs
is_finiteon each element of self, returning a vector mask of the results. In other words, this computes[x.is_finite(), y.is_finite(), ...].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4A | No Documentation 🚧 |
as_u64vec4
Casts all elements of
selftou64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | U64Vec4 | No Documentation 🚧 |
is_nan
Returns
trueif any elements areNaN.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
normalize_or_zero
Returns
selfnormalized to length 1.0 if possible, else returns zero. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be zero. See also [Self::try_normalize()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
length
Computes the length of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
reject_from
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be of non-zero length.Panics
Will panic if
rhshas a length of zero whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
reject_from_normalized
Returns the vector rejection of
selffromrhs. The vector rejection is the vector perpendicular to the projection ofselfontorhs, in rhs words the result ofself - self.project_onto(rhs).rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
length_recip
Computes
1.0 / length(). For valid results,selfmust not be of length zero.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
sub-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
clamp_length_max
Returns a vector with a length no more than
max.Panics
Will panic if
maxis negative whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
ceil
Returns a vector containing the smallest integer greater than or equal to a number for each element of
self.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
clamp
Component-wise clamping of values, similar to [
f32::clamp]. Each element inminmust be less-or-equal to the corresponding element inmax.Panics
Will panic if
minis greater thanmaxwhenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
| min | Vec4 | No Documentation 🚧 |
| max | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
div-2
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
distance
Computes the Euclidean distance between two points in space.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
lerp
Performs a linear interpolation between
selfandrhsbased on the values. Whensis0.0, the result will be equal toself. Whensis1.0, the result will be equal torhs. Whensis outside of range[0, 1], the result is linearly extrapolated.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
project_onto_normalized
Returns the vector projection of
selfontorhs.rhsmust be normalized.Panics
Will panic if
rhsis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
powf
Returns a vector containing each element of
selfraised to the power ofn.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
exp
Returns a vector containing
e^self(the exponential function) for each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
truncate
Creates a 3D vector from the
x,yandzelements ofself, discardingw. Truncation to [Vec3] may also be performed by using [self.xyz()][crate::swizzles::Vec4Swizzles::xyz()]. To truncate to [Vec3A] use [Vec3A::from()].
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec3 | No Documentation 🚧 |
length_squared
Computes the squared length of
self. This is faster thanlength()as it avoids a square root operation.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
dot_into_vec
Returns a vector where every component is the dot product of
selfandrhs.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
round
Returns a vector containing the nearest integer to a number for each element of
self. Round half-way cases away from 0.0.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
max_element
Returns the horizontal maximum of
self. In other words this computesmax(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
min_element
Returns the horizontal minimum of
self. In other words this computesmin(x, y, ..).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | f32 | No Documentation 🚧 |
mul
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
cmpeq
Returns a vector mask containing the result of a
==comparison for each element ofselfandrhs. In other words, this computes[self.x == rhs.x, self.y == rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4A | No Documentation 🚧 |
reflect
Returns the reflection vector for a given incident vector
selfand surface normalnormal.normalmust be normalized.Panics
Will panic if
normalis not normalized whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
with_z
Creates a 4D vector from
selfwith the given value ofz.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
as_uvec4
Casts all elements of
selftou32.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | UVec4 | No Documentation 🚧 |
project_onto
Returns the vector projection of
selfontorhs.rhsmust be of non-zero length.Panics
Will panic if
rhsis zero length whenglam_assertis enabled.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
signum
Returns a vector with elements representing the sign of
self.
1.0if the number is positive,+0.0orINFINITY-1.0if the number is negative,-0.0orNEG_INFINITYNANif the number isNAN
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
add-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
as_i64vec4
Casts all elements of
selftoi64.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | I64Vec4 | No Documentation 🚧 |
with_w
Creates a 4D vector from
selfwith the given value ofw.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
cmple
Returns a vector mask containing the result of a
<=comparison for each element ofselfandrhs. In other words this computes[self.x <= rhs.x, self.y <= rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4A | No Documentation 🚧 |
fract
Returns a vector containing the fractional part of the vector as
self - self.trunc(). Note that this differs from the GLSL implementation offractwhich returnsself - self.floor(). Note that this is fast but not precise for large numbers.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
recip
Returns a vector containing the reciprocal
1.0/nof each element ofself.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
mul_add
Fused multiply-add. Computes
(self * a) + belement-wise with only one rounding error, yielding a more accurate result than an unfused multiply-add. Usingmul_addmay be more performant than an unfused multiply-add if the target architecture has a dedicated fma CPU instruction. However, this is not always true, and will be heavily dependant on designing algorithms with specific target hardware in mind.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
normalize
Returns
selfnormalized to length 1.0. For valid results,selfmust be finite and not of length zero, nor very close to zero. See also [Self::try_normalize()] and [Self::normalize_or_zero()]. Panics Will panic if the resulting normalized vector is not finite whenglam_assertis enabled.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
is_normalized
Returns whether
selfis length1.0or not. Uses a precision threshold of approximately1e-4.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
cmpgt
Returns a vector mask containing the result of a
>comparison for each element ofselfandrhs. In other words this computes[self.x > rhs.x, self.y > rhs.y, ..]for all elements.
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | BVec4A | No Documentation 🚧 |
select
Creates a vector from the elements in
if_trueandif_false, selecting which to use for each element ofself. A true element in the mask uses the corresponding element fromif_true, and false uses the element fromif_false.
Arguments
| Name | Type | Documentation |
|---|---|---|
| mask | BVec4A | No Documentation 🚧 |
| if_true | Vec4 | No Documentation 🚧 |
| if_false | Vec4 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
normalize_or
Returns
selfnormalized to length 1.0 if possible, else returns a fallback value. In particular, if the input is zero (or very close to zero), or non-finite, the result of this operation will be the fallback value. See also [Self::try_normalize()].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
min
Returns a vector containing the minimum values for each element of
selfandrhs. In other words this computes[self.x.min(rhs.x), self.y.min(rhs.y), ..].
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
mul-1
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Vec4 | No Documentation 🚧 |
SmolStr
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| len | No Documentation 🚧 |
| eq | No Documentation 🚧 |
| is_heap_allocated | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| to_string | No Documentation 🚧 |
| is_empty | No Documentation 🚧 |
len
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | SmolStr | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | usize | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
is_heap_allocated
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | SmolStr | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | SmolStr | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | SmolStr | No Documentation 🚧 |
to_string
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | SmolStr | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | String | No Documentation 🚧 |
is_empty
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | SmolStr | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
Uuid
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
| Function | Summary |
|---|---|
| as_u64_pair | Returns two 64bit values containing the value. The bytes in the UUID will be split into two `u64`.... |
| max | The 'max UUID' (all ones). The max UUID is a special form of UUID that is specified to have all 1... |
| eq | No Documentation 🚧 |
| clone | No Documentation 🚧 |
| into_bytes | Consumes self and returns the underlying byte value of the UUID. # Examples ``` # use uuid::Uuid; let bytes = [ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, ]; let uuid = Uuid::from_bytes(bytes); assert_eq!(bytes, uuid.into_bytes()); ``` |
| get_version_num | Returns the version number of the UUID. This represents the algorithm used to generate the value. ... |
| from_bytes_le | Creates a UUID using the supplied bytes in little endian order. The individual fields encoded in t... |
| from_bytes | Creates a UUID using the supplied bytes. # Examples Basic usage: ``` # fn main() -> Result<(), uuid::Error> { # use uuid::Uuid; let bytes = [ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, ]; let uuid = Uuid::from_bytes(bytes); assert_eq!( uuid.hyphenated().to_string(), "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" ); # Ok(()) # } ``` |
| to_bytes_le | Returns the bytes of the UUID in little-endian order. The bytes will be flipped to convert into li... |
| is_max | Tests if the UUID is max (all ones). |
| from_u128_le | Creates a UUID from a 128bit value in little-endian order. The entire value will be flipped to con... |
| new_v4 | Creates a random UUID. This uses the [`getrandom`] crate to utilise the operating system's RNG as the source of random numbers. If you'd like to use a custom generator, don't use this method: generate random bytes using your custom generator and pass them to the [`uuid::Builder::from_random_bytes`]... |
| from_u128 | Creates a UUID from a 128bit value. # Examples Basic usage: ``` # use uuid::Uuid; let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; let uuid = Uuid::from_u128(v); assert_eq!( "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", uuid.hyphenated().to_string(), ); ``` |
| to_u128_le | Returns a 128bit little-endian value containing the value. The bytes in the `u128` will be flipped... |
| as_u128 | Returns a 128bit value containing the value. The bytes in the UUID will be packed directly into a `u128`... |
| is_nil | Tests if the UUID is nil (all zeros). |
| from_u64_pair | Creates a UUID from two 64bit values. # Examples Basic usage: ``` # use uuid::Uuid; let hi = 0xa1a2a3a4b1b2c1c2u64; let lo = 0xd1d2d3d4d5d6d7d8u64; let uuid = Uuid::from_u64_pair(hi, lo); assert_eq!( "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", uuid.hyphenated().to_string(), ); `... |
| assert_receiver_is_total_eq | No Documentation 🚧 |
| nil | The 'nil UUID' (all zeros). The nil UUID is a special form of UUID that is specified to have all ... |
| get_node_id | If the UUID is the correct version (v1, or v6) this will return the node value as a 6-byte array. ... |
| encode_buffer | A buffer that can be used for `encode_...` calls, that is guaranteed to be long enough for any of the format adapters. # Examples ``` # use uuid::Uuid; let uuid = Uuid::nil(); assert_... |
as_u64_pair
Returns two 64bit values containing the value. The bytes in the UUID will be split into two
u64. The first u64 represents the 64 most significant bits, the second one represents the 64 least significant.Examples
# use uuid::Uuid; # fn main() -> Result<(), uuid::Error> { let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; assert_eq!( uuid.as_u64_pair(), (0xa1a2a3a4b1b2c1c2, 0xd1d2d3d4d5d6d7d8), ); # Ok(()) # }
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Uuid | No Documentation 🚧 |
Returns
max
The 'max UUID' (all ones). The max UUID is a special form of UUID that is specified to have all 128 bits set to one.
References
Examples
Basic usage:
# use uuid::Uuid; let uuid = Uuid::max(); assert_eq!( "ffffffff-ffff-ffff-ffff-ffffffffffff", uuid.hyphenated().to_string(), );
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Uuid | No Documentation 🚧 |
eq
No Documentation 🚧
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
clone
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Uuid | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Uuid | No Documentation 🚧 |
into_bytes
Consumes self and returns the underlying byte value of the UUID.
Examples
# use uuid::Uuid; let bytes = [ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, ]; let uuid = Uuid::from_bytes(bytes); assert_eq!(bytes, uuid.into_bytes());
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Uuid | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u8; 16] | No Documentation 🚧 |
get_version_num
Returns the version number of the UUID. This represents the algorithm used to generate the value. This method is the future-proof alternative to [
Uuid::get_version].Examples
Basic usage:
# use uuid::Uuid; # fn main() -> Result<(), uuid::Error> { let my_uuid = Uuid::parse_str("02f09a3f-1624-3b1d-8409-44eff7708208")?; assert_eq!(3, my_uuid.get_version_num()); # Ok(()) # }References
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Uuid | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | usize | No Documentation 🚧 |
from_bytes_le
Creates a UUID using the supplied bytes in little endian order. The individual fields encoded in the buffer will be flipped.
Examples
Basic usage:
# fn main() -> Result<(), uuid::Error> { # use uuid::Uuid; let bytes = [ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, ]; let uuid = Uuid::from_bytes_le(bytes); assert_eq!( "a4a3a2a1-b2b1-c2c1-d1d2-d3d4d5d6d7d8", uuid.hyphenated().to_string(), ); # Ok(()) # }
Arguments
| Name | Type | Documentation |
|---|---|---|
| b | [u8; 16] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Uuid | No Documentation 🚧 |
from_bytes
Creates a UUID using the supplied bytes.
Examples
Basic usage:
# fn main() -> Result<(), uuid::Error> { # use uuid::Uuid; let bytes = [ 0xa1, 0xa2, 0xa3, 0xa4, 0xb1, 0xb2, 0xc1, 0xc2, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, ]; let uuid = Uuid::from_bytes(bytes); assert_eq!( uuid.hyphenated().to_string(), "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" ); # Ok(()) # }
Arguments
| Name | Type | Documentation |
|---|---|---|
| bytes | [u8; 16] | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Uuid | No Documentation 🚧 |
to_bytes_le
Returns the bytes of the UUID in little-endian order. The bytes will be flipped to convert into little-endian order. This is based on the endianness of the UUID, rather than the target environment so bytes will be flipped on both big and little endian machines.
Examples
use uuid::Uuid; # fn main() -> Result<(), uuid::Error> { let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; assert_eq!( uuid.to_bytes_le(), ([ 0xa4, 0xa3, 0xa2, 0xa1, 0xb2, 0xb1, 0xc2, 0xc1, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 ]) ); # Ok(()) # }
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Uuid | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u8; 16] | No Documentation 🚧 |
is_max
Tests if the UUID is max (all ones).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Uuid | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_u128_le
Creates a UUID from a 128bit value in little-endian order. The entire value will be flipped to convert into big-endian order. This is based on the endianness of the UUID, rather than the target environment so bytes will be flipped on both big and little endian machines.
Examples
Basic usage:
# use uuid::Uuid; let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; let uuid = Uuid::from_u128_le(v); assert_eq!( "d8d7d6d5-d4d3-d2d1-c2c1-b2b1a4a3a2a1", uuid.hyphenated().to_string(), );
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u128 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Uuid | No Documentation 🚧 |
new_v4
Creates a random UUID. This uses the [
getrandom] crate to utilise the operating system's RNG as the source of random numbers. If you'd like to use a custom generator, don't use this method: generate random bytes using your custom generator and pass them to the [uuid::Builder::from_random_bytes][from_random_bytes] function instead. Note that usage of this method requires thev4feature of this crate to be enabled.Examples
Basic usage:
# use uuid::{Uuid, Version}; let uuid = Uuid::new_v4(); assert_eq!(Some(Version::Random), uuid.get_version());References
- UUID Version 4 in RFC 9562 [
getrandom]: https://crates.io/crates/getrandom [from_random_bytes]: struct.Builder.html#method.from_random_bytes
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Uuid | No Documentation 🚧 |
from_u128
Creates a UUID from a 128bit value.
Examples
Basic usage:
# use uuid::Uuid; let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; let uuid = Uuid::from_u128(v); assert_eq!( "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", uuid.hyphenated().to_string(), );
Arguments
| Name | Type | Documentation |
|---|---|---|
| v | u128 | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Uuid | No Documentation 🚧 |
to_u128_le
Returns a 128bit little-endian value containing the value. The bytes in the
u128will be flipped to convert into big-endian order. This is based on the endianness of the UUID, rather than the target environment so bytes will be flipped on both big and little endian machines. Note that this will produce a different result than [Uuid::to_fields_le], because the entire UUID is reversed, rather than reversing the individual fields in-place.Examples
# use uuid::Uuid; # fn main() -> Result<(), uuid::Error> { let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; assert_eq!( uuid.to_u128_le(), 0xd8d7d6d5d4d3d2d1c2c1b2b1a4a3a2a1, ); # Ok(()) # }
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Uuid | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u128 | No Documentation 🚧 |
as_u128
Returns a 128bit value containing the value. The bytes in the UUID will be packed directly into a
u128.Examples
# use uuid::Uuid; # fn main() -> Result<(), uuid::Error> { let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; assert_eq!( uuid.as_u128(), 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8, ); # Ok(()) # }
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Uuid | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | u128 | No Documentation 🚧 |
is_nil
Tests if the UUID is nil (all zeros).
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Uuid | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | bool | No Documentation 🚧 |
from_u64_pair
Creates a UUID from two 64bit values.
Examples
Basic usage:
# use uuid::Uuid; let hi = 0xa1a2a3a4b1b2c1c2u64; let lo = 0xd1d2d3d4d5d6d7d8u64; let uuid = Uuid::from_u64_pair(hi, lo); assert_eq!( "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", uuid.hyphenated().to_string(), );
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Uuid | No Documentation 🚧 |
assert_receiver_is_total_eq
No Documentation 🚧
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Uuid | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | () | No Documentation 🚧 |
nil
The 'nil UUID' (all zeros). The nil UUID is a special form of UUID that is specified to have all 128 bits set to zero.
References
Examples
Basic usage:
# use uuid::Uuid; let uuid = Uuid::nil(); assert_eq!( "00000000-0000-0000-0000-000000000000", uuid.hyphenated().to_string(), );
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Uuid | No Documentation 🚧 |
get_node_id
If the UUID is the correct version (v1, or v6) this will return the node value as a 6-byte array. For other versions this will return
None.
Arguments
| Name | Type | Documentation |
|---|---|---|
| _self | Uuid | No Documentation 🚧 |
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | Optional<[u8; 6]> | No Documentation 🚧 |
encode_buffer
A buffer that can be used for
encode_...calls, that is guaranteed to be long enough for any of the format adapters.Examples
# use uuid::Uuid; let uuid = Uuid::nil(); assert_eq!( uuid.simple().encode_lower(&mut Uuid::encode_buffer()), "00000000000000000000000000000000" ); assert_eq!( uuid.hyphenated() .encode_lower(&mut Uuid::encode_buffer()), "00000000-0000-0000-0000-000000000000" ); assert_eq!( uuid.urn().encode_lower(&mut Uuid::encode_buffer()), "urn:uuid:00000000-0000-0000-0000-000000000000" );
Arguments
Returns
| Name | Type | Documentation |
|---|---|---|
| arg0 | [u8; 45] | No Documentation 🚧 |
DynamicFunctionMut
Opaque Type. 🔒
Description
A dynamic mutable script function.
Associated Functions
For function details and documentation, click on the function link.
FunctionCallContext
Opaque Type. 🔒
Description
The caller context when calling a script function. Functions can choose to react to caller preferences such as converting 1-indexed numbers to 0-indexed numbers
Associated Functions
For function details and documentation, click on the function link.
PathBuf
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
String
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
ActiveAnimation
ActiveAnimation
- weight:f32
- repeat:bevy_animation::RepeatAnimation
- speed:f32
- elapsed:f32
- seek_time:f32
- last_seek_time:core::option::Option
- completions:u32
- just_completed:bool
- paused:bool
Description
An animation that an [
AnimationPlayer] is currently either playing or was playing, but is presently paused.A stopped animation is considered no longer active.
Associated Functions
For function details and documentation, click on the function link.
AnimationClip
AnimationClip
- events:bevy_platform::collections::HashMap<bevy_animation::AnimationEventTarget, alloc::vec::Vec<bevy_animation::TimedAnimationEvent>, bevy_platform::hash::FixedHasher>
- duration:f32
Description
A list of [
VariableCurve]s and the [AnimationTargetId]s to which they apply.Because animation clips refer to targets by UUID, they can target any [
AnimationTarget] with that ID.
Associated Functions
For function details and documentation, click on the function link.
AnimationEvent
AnimationEvent
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
AnimationEventTarget
Root
Node
- bevy_animation::AnimationTargetId
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
AnimationPlayer
AnimationPlayer
- active_animations:bevy_platform::collections::HashMap<petgraph::graph::NodeIndex, bevy_animation::ActiveAnimation, bevy_platform::hash::FixedHasher>
- blend_weights:bevy_platform::collections::HashMap<petgraph::graph::NodeIndex, f32, bevy_platform::hash::FixedHasher>
Description
Animation controls.
Automatically added to any root animations of a scene when it is spawned.
Associated Functions
For function details and documentation, click on the function link.
AnimationTarget
AnimationTarget
- id:bevy_animation::AnimationTargetId
- player:bevy_ecs::entity::Entity
Description
An entity that can be animated by an [
AnimationPlayer].These are frequently referred to as bones or joints, because they often refer to individually-animatable parts of an armature.
Asset loaders for armatures are responsible for adding these as necessary. Typically, they're generated from hashed versions of the entire name path from the root of the armature to the bone. See the [
AnimationTargetId] documentation for more details.By convention, asset loaders add [
AnimationTarget] components to the descendants of an [AnimationPlayer], as well as to the [AnimationPlayer] entity itself, but Bevy doesn't require this in any way. So, for example, it's entirely possible for an [AnimationPlayer] to animate a target that it isn't an ancestor of. If you add a new bone to or delete a bone from an armature at runtime, you may want to update the [AnimationTarget] component as appropriate, as Bevy won't do this automatically.Note that each entity can only be animated by one animation player at a time. However, you can change [
AnimationTarget]'splayerproperty at runtime to change which player is responsible for animating the entity.
Associated Functions
For function details and documentation, click on the function link.
AnimationTargetId
AnimationTargetId
- uuid::Uuid
Description
A unique UUID for an animation target (e.g. bone in a skinned mesh).
The [
AnimationClip] asset and the [AnimationTarget] component both use this to refer to targets (e.g. bones in a skinned mesh) to be animated.When importing an armature or an animation clip, asset loaders typically use the full path name from the armature to the bone to generate these UUIDs. The ID is unique to the full path name and based only on the names. So, for example, any imported armature with a bone at the root named
Hipswill assign the same [AnimationTargetId] to its root bone. Likewise, any imported animation clip that animates a root bone namedHipswill reference the same [AnimationTargetId]. Any animation is playable on any armature as long as the bone names match, which allows for easy animation retargeting.Note that asset loaders generally use the full path name to generate the [
AnimationTargetId]. Thus a bone namedChestdirectly connected to a bone namedHipswill have a different ID from a bone namedChestthat's connected to a bone namedStomach.
Associated Functions
For function details and documentation, click on the function link.
RepeatAnimation
Never
Count
- u32
Forever
Description
Repetition behavior of an animation.
Associated Functions
For function details and documentation, click on the function link.
TimedAnimationEvent
TimedAnimationEvent
- time:f32
- event:bevy_animation::AnimationEvent
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
AnimationGraph
AnimationGraph
- graph:petgraph::graph::DiGraph<bevy_animation::graph::AnimationGraphNode, (), u32>
- root:petgraph::graph::NodeIndex
- mask_groups:bevy_platform::collections::HashMap<bevy_animation::AnimationTargetId, u64, bevy_platform::hash::FixedHasher>
Description
A graph structure that describes how animation clips are to be blended together.
Applications frequently want to be able to play multiple animations at once and to fine-tune the influence that animations have on a skinned mesh. Bevy uses an animation graph to store this information. Animation graphs are a directed acyclic graph (DAG) that describes how animations are to be weighted and combined together. Every frame, Bevy evaluates the graph from the root and blends the animations together in a bottom-up fashion to produce the final pose.
There are three types of nodes: blend nodes, add nodes, and clip nodes, all of which can have an associated weight. Blend nodes and add nodes have no associated animation clip and combine the animations of their children according to those children's weights. Clip nodes specify an animation clip to play. When a graph is created, it starts with only a single blend node, the root node.
For example, consider the following graph:
┌────────────┐ │ │ │ Idle ├─────────────────────┐ │ │ │ └────────────┘ │ │ ┌────────────┐ │ ┌────────────┐ │ │ │ │ │ │ Run ├──┐ ├──┤ Root │ │ │ │ ┌────────────┐ │ │ │ └────────────┘ │ │ Blend │ │ └────────────┘ ├──┤ ├──┘ ┌────────────┐ │ │ 0.5 │ │ │ │ └────────────┘ │ Walk ├──┘ │ │ └────────────┘In this case, assuming that Idle, Run, and Walk are all playing with weight 1.0, the Run and Walk animations will be equally blended together, then their weights will be halved and finally blended with the Idle animation. Thus the weight of Run and Walk are effectively half of the weight of Idle.
Nodes can optionally have a mask, a bitfield that restricts the set of animation targets that the node and its descendants affect. Each bit in the mask corresponds to a mask group, which is a set of animation targets (bones). An animation target can belong to any number of mask groups within the context of an animation graph.
When the appropriate bit is set in a node's mask, neither the node nor its descendants will animate any animation targets belonging to that mask group. That is, setting a mask bit to 1 disables the animation targets in that group. If an animation target belongs to multiple mask groups, masking any one of the mask groups that it belongs to will mask that animation target. (Thus an animation target will only be animated if all of its mask groups are unmasked.)
A common use of masks is to allow characters to hold objects. For this, the typical workflow is to assign each character's hand to a mask group. Then, when the character picks up an object, the application masks out the hand that the object is held in for the character's animation set, then positions the hand's digits as necessary to grasp the object. The character's animations will continue to play but will not affect the hand, which will continue to be depicted as holding the object.
Animation graphs are assets and can be serialized to and loaded from RON files. Canonically, such files have an
.animgraph.ronextension.The animation graph implements RFC 51. See that document for more information.
Associated Functions
For function details and documentation, click on the function link.
AnimationGraphHandle
AnimationGraphHandle
- bevy_asset::handle::Handle<bevy_animation::graph::AnimationGraph>
Description
A [
Handle] to the [AnimationGraph] to be used by theAnimationPlayeron the same entity.
Associated Functions
For function details and documentation, click on the function link.
ThreadedAnimationGraph
ThreadedAnimationGraph
- threaded_graph:alloc::vec::Vecpetgraph::graph::NodeIndex
- sorted_edge_ranges:alloc::vec::Vec<core::ops::Range
> - sorted_edges:alloc::vec::Vecpetgraph::graph::NodeIndex
- computed_masks:alloc::vec::Vec
Description
An acceleration structure for an animation graph that allows Bevy to evaluate it quickly.
This is kept up to date as the associated [
AnimationGraph] instance is added, modified, or removed.
Associated Functions
For function details and documentation, click on the function link.
ThreadedAnimationGraphs
ThreadedAnimationGraphs
- bevy_platform::collections::HashMap<bevy_asset::id::AssetId<bevy_animation::graph::AnimationGraph>, bevy_animation::graph::ThreadedAnimationGraph, bevy_platform::hash::FixedHasher>
Description
Acceleration structures for animation graphs that allows Bevy to evaluate them quickly.
These are kept up to date as [
AnimationGraph] instances are added, modified, and removed.
Associated Functions
For function details and documentation, click on the function link.
AnimationTransition
AnimationTransition
- current_weight:f32
- weight_decline_per_sec:f32
- animation:petgraph::graph::NodeIndex
Description
An animation that is being faded out as part of a transition
Associated Functions
For function details and documentation, click on the function link.
AnimationTransitions
AnimationTransitions
- main_animation:core::option::Optionpetgraph::graph::NodeIndex
- transitions:alloc::vec::Vec<bevy_animation::transition::AnimationTransition>
Description
Manages fade-out of animation blend factors, allowing for smooth transitions between animations.
To use this component, place it on the same entity as the [
AnimationPlayer] andAnimationGraphHandle. It'll take responsibility for adjusting the weight on the [ActiveAnimation] in order to fade out animations smoothly.When using an [
AnimationTransitions] component, you should play all animations through the [AnimationTransitions::play] method, rather than by directly manipulating the [AnimationPlayer]. Playing animations through the [AnimationPlayer] directly will cause the [AnimationTransitions] component to get confused about which animation is the "main" animation, and transitions will usually be incorrect as a result.
Associated Functions
For function details and documentation, click on the function link.
AssetIndex
AssetIndex
- generation:u32
- index:u32
Description
A generational runtime-only identifier for a specific [
Asset] stored in [Assets]. This is optimized for efficient runtime usage and is not suitable for identifying assets across app runs.
Associated Functions
For function details and documentation, click on the function link.
AssetPath
Opaque Type. 🔒
Description
Represents a path to an asset in a "virtual filesystem".
Asset paths consist of three main parts:
- [
AssetPath::source]: The name of theAssetSourceto load the asset from. This is optional. If one is not set the default source will be used (which is theassetsfolder by default).- [
AssetPath::path]: The "virtual filesystem path" pointing to an asset source file.- [
AssetPath::label]: An optional "named sub asset". When assets are loaded, they are allowed to load "sub assets" of any type, which are identified by a named "label".Asset paths are generally constructed (and visualized) as strings:
# use bevy_asset::{Asset, AssetServer, Handle}; # use bevy_reflect::TypePath; # # #[derive(Asset, TypePath, Default)] # struct Mesh; # # #[derive(Asset, TypePath, Default)] # struct Scene; # # let asset_server: AssetServer = panic!(); // This loads the `my_scene.scn` base asset from the default asset source. let scene: Handle<Scene> = asset_server.load("my_scene.scn"); // This loads the `PlayerMesh` labeled asset from the `my_scene.scn` base asset in the default asset source. let mesh: Handle<Mesh> = asset_server.load("my_scene.scn#PlayerMesh"); // This loads the `my_scene.scn` base asset from a custom 'remote' asset source. let scene: Handle<Scene> = asset_server.load("remote://my_scene.scn");[
AssetPath] implements [From] for&'static str,&'static Path, and&'a String, which allows us to optimize the static cases. This means that the common case ofasset_server.load("my_scene.scn")when it creates and clones internal ownedAssetPaths. This also means that you should use [AssetPath::parse] in cases where&stris the explicit type.
Associated Functions
For function details and documentation, click on the function link.
RenderAssetUsages
Opaque Type. 🔒
Description
Defines where the asset will be used.
If an asset is set to the
RENDER_WORLDbut not theMAIN_WORLD, the asset will be unloaded from the asset server once it's been extracted and prepared in the render world.Unloading the asset saves on memory, as for most cases it is no longer necessary to keep it in RAM once it's been uploaded to the GPU's VRAM. However, this means you can no longer access the asset from the CPU (via the
Assets<T>resource) once unloaded (without re-loading it).If you never need access to the asset from the CPU past the first frame it's loaded on, or only need very infrequent access, then set this to
RENDER_WORLD. Otherwise, set this toRENDER_WORLD | MAIN_WORLD.If you have an asset that doesn't actually need to end up in the render world, like an Image that will be decoded into another Image asset, use
MAIN_WORLDonly.Platform-specific
On Wasm, it is not possible for now to free reserved memory. To control memory usage, load assets in sequence and unload one before loading the next. See this discussion about memory management for more details.
Associated Functions
For function details and documentation, click on the function link.
DefaultSpatialScale
DefaultSpatialScale
- bevy_audio::audio::SpatialScale
Description
The default scale factor applied to the positions of audio sources and listeners for spatial audio. Can be overridden for individual sounds in [
PlaybackSettings].You may need to adjust this scale to fit your world's units.
Default is
Vec3::ONE.
Associated Functions
For function details and documentation, click on the function link.
PlaybackMode
Once
Loop
Despawn
Remove
Description
The way Bevy manages the sound playback.
Associated Functions
For function details and documentation, click on the function link.
PlaybackSettings
PlaybackSettings
- mode:bevy_audio::audio::PlaybackMode
- volume:bevy_audio::volume::Volume
- speed:f32
- paused:bool
- muted:bool
- spatial:bool
- spatial_scale:core::option::Option<bevy_audio::audio::SpatialScale>
Description
Initial settings to be used when audio starts playing.
If you would like to control the audio while it is playing, query for the [
AudioSink][crate::AudioSink] or [SpatialAudioSink][crate::SpatialAudioSink] components. Changes to this component will not be applied to already-playing audio.
Associated Functions
For function details and documentation, click on the function link.
SpatialListener
SpatialListener
- left_ear_offset:glam::Vec3
- right_ear_offset:glam::Vec3
Description
Settings for the listener for spatial audio sources.
This must be accompanied by
TransformandGlobalTransform. Only one entity with aSpatialListenershould be present at any given time.
Associated Functions
For function details and documentation, click on the function link.
SpatialScale
SpatialScale
- glam::Vec3
Description
A scale factor applied to the positions of audio sources and listeners for spatial audio.
Default is
Vec3::ONE.
Associated Functions
For function details and documentation, click on the function link.
GlobalVolume
GlobalVolume
- volume:bevy_audio::volume::Volume
Description
Use this [
Resource] to control the global volume of all audio.Note: Changing [
GlobalVolume] does not affect already playing audio.
Associated Functions
For function details and documentation, click on the function link.
Volume
Linear
- f32
Decibels
- f32
Description
A [
Volume] represents an audio source's volume level.To create a new [
Volume] from a linear scale value, use [Volume::Linear].To create a new [
Volume] from decibels, use [Volume::Decibels].
Associated Functions
For function details and documentation, click on the function link.
Color
Srgba
- bevy_color::srgba::Srgba
LinearRgba
- bevy_color::linear_rgba::LinearRgba
Hsla
- bevy_color::hsla::Hsla
Hsva
- bevy_color::hsva::Hsva
Hwba
- bevy_color::hwba::Hwba
Laba
- bevy_color::laba::Laba
Lcha
- bevy_color::lcha::Lcha
Oklaba
- bevy_color::oklaba::Oklaba
Oklcha
- bevy_color::oklcha::Oklcha
Xyza
- bevy_color::xyza::Xyza
Description
An enumerated type that can represent any of the color types in this crate.
This is useful when you need to store a color in a data structure that can't be generic over the color type.
Operations
[
Color] supports all the standard color operations, such as mixing, luminance and hue adjustment, and diffing. These operations delegate to the concrete color space contained by [Color], but will convert toOklchfor operations which aren't supported in the current space. After performing the operation, if a conversion was required, the result will be converted back into the original color space.#![allow(unused)] fn main() { use bevy_color::{Hue, Color}; let red_hsv = Color::hsv(0., 1., 1.); let red_srgb = Color::srgb(1., 0., 0.); // HSV has a definition of hue, so it will be returned. red_hsv.hue(); // SRGB doesn't have a native definition for hue. // Converts to Oklch and returns that result. red_srgb.hue(); }
Oklchhas been chosen as the intermediary space in cases where conversion is required due to its perceptual uniformity and broad support for Bevy's color operations. To avoid the cost of repeated conversion, and ensure consistent results where that is desired, first convert this [Color] into your desired color space.
Associated Functions
For function details and documentation, click on the function link.
Hsla
Hsla
- hue:f32
- saturation:f32
- lightness:f32
- alpha:f32
Description
Color in Hue-Saturation-Lightness (HSL) color space with alpha. Further information on this color model can be found on Wikipedia.
Associated Functions
For function details and documentation, click on the function link.
Hsva
Hsva
- hue:f32
- saturation:f32
- value:f32
- alpha:f32
Description
Color in Hue-Saturation-Value (HSV) color space with alpha. Further information on this color model can be found on Wikipedia.
Associated Functions
For function details and documentation, click on the function link.
Hwba
Hwba
- hue:f32
- whiteness:f32
- blackness:f32
- alpha:f32
Description
Color in Hue-Whiteness-Blackness (HWB) color space with alpha. Further information on this color model can be found on Wikipedia.
Associated Functions
For function details and documentation, click on the function link.
Laba
Laba
- lightness:f32
- a:f32
- b:f32
- alpha:f32
Description
Color in LAB color space, with alpha
Associated Functions
For function details and documentation, click on the function link.
Lcha
Lcha
- lightness:f32
- chroma:f32
- hue:f32
- alpha:f32
Description
Color in LCH color space, with alpha
Associated Functions
For function details and documentation, click on the function link.
LinearRgba
LinearRgba
- red:f32
- green:f32
- blue:f32
- alpha:f32
Description
Linear RGB color with alpha.
Associated Functions
For function details and documentation, click on the function link.
Oklaba
Oklaba
- lightness:f32
- a:f32
- b:f32
- alpha:f32
Description
Color in Oklab color space, with alpha
Associated Functions
For function details and documentation, click on the function link.
Oklcha
Oklcha
- lightness:f32
- chroma:f32
- hue:f32
- alpha:f32
Description
Color in Oklch color space, with alpha
Associated Functions
For function details and documentation, click on the function link.
Srgba
Srgba
- red:f32
- green:f32
- blue:f32
- alpha:f32
Description
Non-linear standard RGB with alpha.
Associated Functions
For function details and documentation, click on the function link.
Xyza
Xyza
- x:f32
- y:f32
- z:f32
- alpha:f32
Description
CIE 1931 color space, also known as XYZ, with an alpha channel.
Associated Functions
For function details and documentation, click on the function link.
Bloom
Bloom
- intensity:f32
- low_frequency_boost:f32
- low_frequency_boost_curvature:f32
- high_pass_frequency:f32
- prefilter:bevy_core_pipeline::bloom::settings::BloomPrefilter
- composite_mode:bevy_core_pipeline::bloom::settings::BloomCompositeMode
- max_mip_dimension:u32
- scale:glam::Vec2
Description
Applies a bloom effect to an HDR-enabled 2d or 3d camera.
Bloom emulates an effect found in real cameras and the human eye, causing halos to appear around very bright parts of the scene.
See also https://en.wikipedia.org/wiki/Bloom_(shader_effect).
Usage Notes
Bloom is currently not compatible with WebGL2.
Often used in conjunction with
bevy_pbr::StandardMaterial::emissivefor 3d meshes.Bloom is best used alongside a tonemapping function that desaturates bright colors, such as [
crate::tonemapping::Tonemapping::TonyMcMapface].Bevy's implementation uses a parametric curve to blend between a set of blurred (lower frequency) images generated from the camera's view. See https://starlederer.github.io/bloom/ for a visualization of the parametric curve used in Bevy as well as a visualization of the curve's respective scattering profile.
Associated Functions
For function details and documentation, click on the function link.
BloomCompositeMode
EnergyConserving
Additive
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
BloomPrefilter
BloomPrefilter
- threshold:f32
- threshold_softness:f32
Description
Applies a threshold filter to the input image to extract the brightest regions before blurring them and compositing back onto the original image. These settings are useful when emulating the 1990s-2000s game look.
Considerations
- Changing these settings creates a physically inaccurate image
- Changing these settings makes it easy to make the final result look worse
- Non-default prefilter settings should be used in conjunction with [
BloomCompositeMode::Additive]
Associated Functions
For function details and documentation, click on the function link.
ContrastAdaptiveSharpening
ContrastAdaptiveSharpening
- enabled:bool
- sharpening_strength:f32
- denoise:bool
Description
Applies a contrast adaptive sharpening (CAS) filter to the camera.
CAS is usually used in combination with shader based anti-aliasing methods such as FXAA or TAA to regain some of the lost detail from the blurring that they introduce.
CAS is designed to adjust the amount of sharpening applied to different areas of an image based on the local contrast. This can help avoid over-sharpening areas with high contrast and under-sharpening areas with low contrast.
To use this, add the [
ContrastAdaptiveSharpening] component to a 2D or 3D camera.
Associated Functions
For function details and documentation, click on the function link.
Camera2d
Camera2d
Description
A 2D camera component. Enables the 2D render graph for a [
Camera].
Associated Functions
For function details and documentation, click on the function link.
Camera3d
Camera3d
- depth_load_op:bevy_core_pipeline::core_3d::camera_3d::Camera3dDepthLoadOp
- depth_texture_usages:bevy_core_pipeline::core_3d::camera_3d::Camera3dDepthTextureUsage
- screen_space_specular_transmission_steps:usize
- screen_space_specular_transmission_quality:bevy_core_pipeline::core_3d::camera_3d::ScreenSpaceTransmissionQuality
Description
A 3D camera component. Enables the main 3D render graph for a [
Camera].The camera coordinate space is right-handed X-right, Y-up, Z-back. This means "forward" is -Z.
Associated Functions
For function details and documentation, click on the function link.
Camera3dDepthLoadOp
Clear
- f32
Load
Description
The depth clear operation to perform for the main 3d pass.
Associated Functions
For function details and documentation, click on the function link.
Camera3dDepthTextureUsage
Camera3dDepthTextureUsage
- u32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
ScreenSpaceTransmissionQuality
Low
Medium
High
Ultra
Description
The quality of the screen space transmission blur effect, applied to whatever's “behind” transmissive objects when their
roughnessis greater than0.0.Higher qualities are more GPU-intensive.
Note: You can get better-looking results at any quality level by enabling TAA. See:
TemporalAntiAliasPlugin.
Associated Functions
For function details and documentation, click on the function link.
DepthOfField
DepthOfField
- mode:bevy_core_pipeline::dof::DepthOfFieldMode
- focal_distance:f32
- sensor_height:f32
- aperture_f_stops:f32
- max_circle_of_confusion_diameter:f32
- max_depth:f32
Description
A component that enables a depth of field postprocessing effect when attached to a [
Camera3d], simulating the focus of a camera lens.
Associated Functions
For function details and documentation, click on the function link.
DepthOfFieldMode
Bokeh
Gaussian
Description
Controls the appearance of the effect.
Associated Functions
For function details and documentation, click on the function link.
Fxaa
Fxaa
- enabled:bool
- edge_threshold:bevy_core_pipeline::fxaa::Sensitivity
- edge_threshold_min:bevy_core_pipeline::fxaa::Sensitivity
Description
A component for enabling Fast Approximate Anti-Aliasing (FXAA) for a [
bevy_render::camera::Camera].
Associated Functions
For function details and documentation, click on the function link.
Sensitivity
Low
Medium
High
Ultra
Extreme
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
OrderIndependentTransparencySettings
OrderIndependentTransparencySettings
- layer_count:i32
- alpha_threshold:f32
Description
Used to identify which camera will use OIT to render transparent meshes and to configure OIT.
Associated Functions
For function details and documentation, click on the function link.
ChromaticAberration
ChromaticAberration
- color_lut:bevy_asset::handle::Handle<bevy_image::image::Image>
- intensity:f32
- max_samples:u32
Description
Adds colored fringes to the edges of objects in the scene.
Chromatic aberration simulates the effect when lenses fail to focus all colors of light toward a single point. It causes rainbow-colored streaks to appear, which are especially apparent on the edges of objects. Chromatic aberration is commonly used for collision effects, especially in horror games.
Bevy's implementation is based on that of Inside (Gjøl & Svendsen 2016). It's based on a customizable lookup texture, which allows for changing the color pattern. By default, the color pattern is simply a 3×1 pixel texture consisting of red, green, and blue, in that order, but you can change it to any image in order to achieve different effects.
Associated Functions
For function details and documentation, click on the function link.
DeferredPrepass
DeferredPrepass
Description
If added to a [
crate::prelude::Camera3d] then deferred materials will be rendered to the deferred gbuffer texture and will be available to subsequent passes. Note the default deferred lighting plugin also requiresDepthPrepassto work correctly.
Associated Functions
For function details and documentation, click on the function link.
DepthPrepass
DepthPrepass
Description
If added to a [
crate::prelude::Camera3d] then depth values will be copied to a separate texture available to the main pass.
Associated Functions
For function details and documentation, click on the function link.
MotionVectorPrepass
MotionVectorPrepass
Description
If added to a [
crate::prelude::Camera3d] then screen space motion vectors will be copied to a separate texture available to the main pass.
Associated Functions
For function details and documentation, click on the function link.
NormalPrepass
NormalPrepass
Description
If added to a [
crate::prelude::Camera3d] then vertex world normals will be copied to a separate texture available to the main pass. Normals will have normal map textures already applied.
Associated Functions
For function details and documentation, click on the function link.
Skybox
Skybox
- image:bevy_asset::handle::Handle<bevy_image::image::Image>
- brightness:f32
- rotation:glam::Quat
Description
Adds a skybox to a 3D camera, based on a cubemap texture.
Note that this component does not (currently) affect the scene's lighting. To do so, use
EnvironmentMapLightalongside this component.See also https://en.wikipedia.org/wiki/Skybox_(video_games).
Associated Functions
For function details and documentation, click on the function link.
Smaa
Smaa
- preset:bevy_core_pipeline::smaa::SmaaPreset
Description
A component for enabling Subpixel Morphological Anti-Aliasing (SMAA) for a [
bevy_render::camera::Camera].
Associated Functions
For function details and documentation, click on the function link.
SmaaPreset
Low
Medium
High
Ultra
Description
A preset quality level for SMAA.
Higher values are slower but result in a higher-quality image.
The default value is high.
Associated Functions
For function details and documentation, click on the function link.
DebandDither
Disabled
Enabled
Description
Enables a debanding shader that applies dithering to mitigate color banding in the final image for a given [
Camera] entity.
Associated Functions
For function details and documentation, click on the function link.
Tonemapping
None
Reinhard
ReinhardLuminance
AcesFitted
AgX
SomewhatBoringDisplayTransform
TonyMcMapface
BlenderFilmic
Description
Optionally enables a tonemapping shader that attempts to map linear input stimulus into a perceptually uniform image for a given [
Camera] entity.
Associated Functions
For function details and documentation, click on the function link.
SystemIdMarker
SystemIdMarker
Description
Marker
Componentfor identifying [SystemId] [Entity]s.
Associated Functions
For function details and documentation, click on the function link.
OnAdd
OnAdd
Description
Trigger emitted when a component is inserted onto an entity that does not already have that component. Runs before
OnInsert. See [crate::component::ComponentHooks::on_add] for more information.
Associated Functions
For function details and documentation, click on the function link.
OnDespawn
OnDespawn
Description
Trigger emitted for each component on an entity when it is despawned. See [
crate::component::ComponentHooks::on_despawn] for more information.
Associated Functions
For function details and documentation, click on the function link.
OnInsert
OnInsert
Description
Trigger emitted when a component is inserted, regardless of whether or not the entity already had that component. Runs after
OnAdd, if it ran. See [crate::component::ComponentHooks::on_insert] for more information.
Associated Functions
For function details and documentation, click on the function link.
OnRemove
OnRemove
Description
Trigger emitted when a component is removed from an entity, and runs before the component is removed, so you can still access the component data. See [
crate::component::ComponentHooks::on_remove] for more information.
Associated Functions
For function details and documentation, click on the function link.
OnReplace
OnReplace
Description
Trigger emitted when a component is inserted onto an entity that already has that component. Runs before the value is replaced, so you can still access the original component data. See [
crate::component::ComponentHooks::on_replace] for more information.
Associated Functions
For function details and documentation, click on the function link.
AabbGizmoConfigGroup
AabbGizmoConfigGroup
- draw_all:bool
- default_color:core::option::Option<bevy_color::color::Color>
Description
The [
GizmoConfigGroup] used for debug visualizations of [Aabb] components on entities
Associated Functions
For function details and documentation, click on the function link.
GizmoConfig
GizmoConfig
- enabled:bool
- line:bevy_gizmos::config::GizmoLineConfig
- depth_bias:f32
- render_layers:bevy_render::view::visibility::render_layers::RenderLayers
Description
A struct that stores configuration for gizmos.
Associated Functions
For function details and documentation, click on the function link.
GizmoConfigStore
GizmoConfigStore
Description
A [
Resource] storing [GizmoConfig] and [GizmoConfigGroup] structsUse
app.init_gizmo_group::<T>()to register a custom config group.
Associated Functions
For function details and documentation, click on the function link.
GizmoLineConfig
GizmoLineConfig
- width:f32
- perspective:bool
- style:bevy_gizmos::config::GizmoLineStyle
- joints:bevy_gizmos::config::GizmoLineJoint
Description
A struct that stores configuration for gizmos.
Associated Functions
For function details and documentation, click on the function link.
GizmoLineJoint
None
Miter
Round
- u32
Bevel
Description
An enum configuring how line joints will be drawn.
Associated Functions
For function details and documentation, click on the function link.
GizmoLineStyle
Solid
Dotted
Dashed
- gap_scale:f32
- line_scale:f32
Description
An enum used to configure the style of gizmo lines, similar to CSS line-style
Associated Functions
For function details and documentation, click on the function link.
LightGizmoColor
Manual
- bevy_color::color::Color
Varied
MatchLightColor
ByLightType
Description
Configures how a color is attributed to a light gizmo.
Associated Functions
For function details and documentation, click on the function link.
LightGizmoConfigGroup
LightGizmoConfigGroup
- draw_all:bool
- color:bevy_gizmos::light::LightGizmoColor
- point_light_color:bevy_color::color::Color
- spot_light_color:bevy_color::color::Color
- directional_light_color:bevy_color::color::Color
Description
The [
GizmoConfigGroup] used to configure the visualization of lights.
Associated Functions
For function details and documentation, click on the function link.
GltfExtras
GltfExtras
- value:String
Description
Additional untyped data that can be present on most glTF types at the primitive level.
Associated Functions
For function details and documentation, click on the function link.
GltfMaterialExtras
GltfMaterialExtras
- value:String
Description
Additional untyped data that can be present on most glTF types at the material level.
Associated Functions
For function details and documentation, click on the function link.
GltfMaterialName
GltfMaterialName
- String
Description
The material name of a glTF primitive.
Associated Functions
For function details and documentation, click on the function link.
GltfMeshExtras
GltfMeshExtras
- value:String
Description
Additional untyped data that can be present on most glTF types at the mesh level.
Associated Functions
For function details and documentation, click on the function link.
GltfSceneExtras
GltfSceneExtras
- value:String
Description
Additional untyped data that can be present on most glTF types at the scene level.
Associated Functions
For function details and documentation, click on the function link.
Image
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
TextureAtlas
TextureAtlas
- layout:bevy_asset::handle::Handle<bevy_image::texture_atlas::TextureAtlasLayout>
- index:usize
Description
An index into a [
TextureAtlasLayout], which corresponds to a specific section of a texture.It stores a handle to [
TextureAtlasLayout] and the index of the current section of the atlas. The texture atlas contains various sections of a given texture, allowing users to have a single image file for either sprite animation or global mapping. You can change the textureindexof the atlas to animate the sprite or display only a section of the texture for efficient rendering of related game objects.Check the following examples for usage:
Associated Functions
For function details and documentation, click on the function link.
TextureAtlasLayout
TextureAtlasLayout
- size:glam::UVec2
- textures:alloc::vec::Vec<bevy_math::rects::urect::URect>
Description
Stores a map used to lookup the position of a texture in a [
TextureAtlas]. This can be used to either use and look up a specific section of a texture, or animate frame-by-frame as a sprite sheet.Optionally it can store a mapping from sub texture handles to the related area index (see
TextureAtlasBuilder).Example usage animating sprite. Example usage animating sprite in response to an event. Example usage loading sprite sheet.
Associated Functions
For function details and documentation, click on the function link.
Affine3
Affine3
- matrix3:glam::Mat3
- translation:glam::Vec3
Description
Reduced-size version of
glam::Affine3Afor use when storage has significant performance impact. Convert toglam::Affine3Ato do non-trivial calculations.
Associated Functions
For function details and documentation, click on the function link.
Indices
U16
- alloc::vec::Vec
U32
- alloc::vec::Vec
Description
An array of indices into the
VertexAttributeValuesfor a mesh.It describes the order in which the vertex attributes should be joined into faces.
Associated Functions
For function details and documentation, click on the function link.
Mesh
Mesh
- indices:core::option::Option<bevy_mesh::index::Indices>
- morph_targets:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- morph_target_names:core::option::Option<alloc::vec::Vecalloc::string::String>
- asset_usage:bevy_asset::render_asset::RenderAssetUsages
Description
A 3D object made out of vertices representing triangles, lines, or points, with "attribute" values for each vertex.
Meshes can be automatically generated by a bevy
AssetLoader(generally by loading aGltffile), or by converting a primitive usinginto. It is also possible to create one manually. They can be edited after creation.Meshes can be rendered with a
Mesh2dandMeshMaterial2dorMesh3dandMeshMaterial3dfor 2D and 3D respectively.A [
Mesh] in Bevy is equivalent to a "primitive" in the glTF format, for a glTF Mesh representation, seeGltfMesh.Manual creation
The following function will construct a flat mesh, to be rendered with a
StandardMaterialorColorMaterial:# use bevy_mesh::{Mesh, Indices, PrimitiveTopology}; # use bevy_asset::RenderAssetUsages; fn create_simple_parallelogram() -> Mesh { // Create a new mesh using a triangle list topology, where each set of 3 vertices composes a triangle. Mesh::new(PrimitiveTopology::TriangleList, RenderAssetUsages::default()) // Add 4 vertices, each with its own position attribute (coordinate in // 3D space), for each of the corners of the parallelogram. .with_inserted_attribute( Mesh::ATTRIBUTE_POSITION, vec![[0.0, 0.0, 0.0], [1.0, 2.0, 0.0], [2.0, 2.0, 0.0], [1.0, 0.0, 0.0]] ) // Assign a UV coordinate to each vertex. .with_inserted_attribute( Mesh::ATTRIBUTE_UV_0, vec![[0.0, 1.0], [0.5, 0.0], [1.0, 0.0], [0.5, 1.0]] ) // Assign normals (everything points outwards) .with_inserted_attribute( Mesh::ATTRIBUTE_NORMAL, vec![[0.0, 0.0, 1.0], [0.0, 0.0, 1.0], [0.0, 0.0, 1.0], [0.0, 0.0, 1.0]] ) // After defining all the vertices and their attributes, build each triangle using the // indices of the vertices that make it up in a counter-clockwise order. .with_inserted_indices(Indices::U32(vec![ // First triangle 0, 3, 1, // Second triangle 1, 3, 2 ])) }You can see how it looks like here, used in a
Mesh3dwith a square bevy logo texture, with added axis, points, lines and text for clarity.Other examples
For further visualization, explanation, and examples, see the built-in Bevy examples, and the implementation of the built-in shapes. In particular, generate_custom_mesh teaches you to access and modify the attributes of a [
Mesh] after creating it.Common points of confusion
- UV maps in Bevy start at the top-left, see
ATTRIBUTE_UV_0, other APIs can have other conventions,OpenGLstarts at bottom-left.- It is possible and sometimes useful for multiple vertices to have the same position attribute value, it's a common technique in 3D modeling for complex UV mapping or other calculations.
- Bevy performs frustum culling based on the
Aabbof meshes, which is calculated and added automatically for new meshes only. If a mesh is modified, the entity'sAabbneeds to be updated manually or deleted so that it is re-calculated.Use with
StandardMaterialTo render correctly with
StandardMaterial, a mesh needs to have properly defined:
UVs: Bevy needs to know how to map a texture onto the mesh (also true forColorMaterial).Normals: Bevy needs to know how light interacts with your mesh. [0.0, 0.0, 1.0] is very common for simple flat meshes on the XY plane, because simple meshes are smooth and they don't require complex light calculations.- Vertex winding order: by default,
StandardMaterial.cull_modeisSome(Face::Back), which means that Bevy would only render the "front" of each triangle, which is the side of the triangle from where the vertices appear in a counter-clockwise order.
Associated Functions
For function details and documentation, click on the function link.
MeshMorphWeights
MeshMorphWeights
- weights:alloc::vec::Vec
Description
Control a specific [
Mesh] instance's morph targets. These control the weights of specific "mesh primitives" in scene formats like GLTF. They can be set manually, but in most cases they should "automatically" synced by setting the [MorphWeights] component on a parent entity.See [
MorphWeights] for more details on Bevy's morph target implementation.Add this to an [
Entity] with aMesh3dwith a [MorphAttributes] set to control individual weights of each morph target.
Associated Functions
For function details and documentation, click on the function link.
MorphWeights
MorphWeights
- weights:alloc::vec::Vec
- first_mesh:core::option::Option<bevy_asset::handle::Handle<bevy_mesh::mesh::Mesh>>
Description
Controls the morph targets for all child
Mesh3dentities. In most cases, [MorphWeights] should be considered the "source of truth" when writing morph targets for meshes. However you can choose to write child [MeshMorphWeights] if your situation requires more granularity. Just note that if you set [MorphWeights], it will overwrite child [MeshMorphWeights] values.This exists because Bevy's [
Mesh] corresponds to a single surface / material, whereas morph targets as defined in the GLTF spec exist on "multi-primitive meshes" (where each primitive is its own surface with its own material). Therefore in Bevy [MorphWeights] an a parent entity are the "canonical weights" from a GLTF perspective, which then synchronized to childMesh3d/ [MeshMorphWeights] (which correspond to "primitives" / "surfaces" from a GLTF perspective).Add this to the parent of one or more
Entitieswith aMesh3dwith a [MeshMorphWeights].
Associated Functions
For function details and documentation, click on the function link.
AnnulusMeshBuilder
AnnulusMeshBuilder
- annulus:bevy_math::primitives::dim2::Annulus
- resolution:u32
Description
A builder for creating a [
Mesh] with an [Annulus] shape.
Associated Functions
For function details and documentation, click on the function link.
Capsule2dMeshBuilder
Capsule2dMeshBuilder
- capsule:bevy_math::primitives::dim2::Capsule2d
- resolution:u32
Description
A builder used for creating a [
Mesh] with a [Capsule2d] shape.
Associated Functions
For function details and documentation, click on the function link.
CircleMeshBuilder
CircleMeshBuilder
- circle:bevy_math::primitives::dim2::Circle
- resolution:u32
Description
A builder used for creating a [
Mesh] with a [Circle] shape.
Associated Functions
For function details and documentation, click on the function link.
CircularMeshUvMode
Mask
- angle:f32
Description
Specifies how to generate UV-mappings for the [
CircularSector] and [CircularSegment] shapes.Currently the only variant is
Mask, which is good for showing a portion of a texture that includes the entire circle, particularly the same texture will be displayed with different fractions of a complete circle.It's expected that more will be added in the future, such as a variant that causes the texture to be scaled to fit the bounding box of the shape, which would be good for packed textures only including the portion of the circle that is needed to display.
Associated Functions
For function details and documentation, click on the function link.
CircularSectorMeshBuilder
CircularSectorMeshBuilder
- sector:bevy_math::primitives::dim2::CircularSector
- resolution:u32
- uv_mode:bevy_mesh::primitives::dim2::CircularMeshUvMode
Description
A builder used for creating a [
Mesh] with a [CircularSector] shape.The resulting mesh will have a UV-map such that the center of the circle is at the center of the texture.
Associated Functions
For function details and documentation, click on the function link.
CircularSegmentMeshBuilder
CircularSegmentMeshBuilder
- segment:bevy_math::primitives::dim2::CircularSegment
- resolution:u32
- uv_mode:bevy_mesh::primitives::dim2::CircularMeshUvMode
Description
A builder used for creating a [
Mesh] with a [CircularSegment] shape.The resulting mesh will have a UV-map such that the center of the circle is at the center of the texture.
Associated Functions
For function details and documentation, click on the function link.
EllipseMeshBuilder
EllipseMeshBuilder
- ellipse:bevy_math::primitives::dim2::Ellipse
- resolution:u32
Description
A builder used for creating a [
Mesh] with an [Ellipse] shape.
Associated Functions
For function details and documentation, click on the function link.
RectangleMeshBuilder
RectangleMeshBuilder
- half_size:glam::Vec2
Description
A builder used for creating a [
Mesh] with a [Rectangle] shape.
Associated Functions
For function details and documentation, click on the function link.
RegularPolygonMeshBuilder
RegularPolygonMeshBuilder
- circumradius:f32
- sides:u32
Description
A builder used for creating a [
Mesh] with a [RegularPolygon] shape.
Associated Functions
For function details and documentation, click on the function link.
RhombusMeshBuilder
RhombusMeshBuilder
- half_diagonals:glam::Vec2
Description
A builder for creating a [
Mesh] with an [Rhombus] shape.
Associated Functions
For function details and documentation, click on the function link.
Triangle2dMeshBuilder
Triangle2dMeshBuilder
- triangle:bevy_math::primitives::dim2::Triangle2d
Description
A builder used for creating a [
Mesh] with a [Triangle2d] shape.
Associated Functions
For function details and documentation, click on the function link.
Capsule3dMeshBuilder
Capsule3dMeshBuilder
- capsule:bevy_math::primitives::dim3::Capsule3d
- rings:u32
- longitudes:u32
- latitudes:u32
- uv_profile:bevy_mesh::primitives::dim3::capsule::CapsuleUvProfile
Description
A builder used for creating a [
Mesh] with a [Capsule3d] shape.
Associated Functions
For function details and documentation, click on the function link.
CapsuleUvProfile
Aspect
Uniform
Fixed
Description
Manner in which UV coordinates are distributed vertically.
Associated Functions
For function details and documentation, click on the function link.
ConeAnchor
MidPoint
Tip
Base
Description
Anchoring options for [
ConeMeshBuilder]
Associated Functions
For function details and documentation, click on the function link.
ConeMeshBuilder
ConeMeshBuilder
- cone:bevy_math::primitives::dim3::Cone
- resolution:u32
- anchor:bevy_mesh::primitives::dim3::cone::ConeAnchor
Description
A builder used for creating a [
Mesh] with a [Cone] shape.
Associated Functions
For function details and documentation, click on the function link.
ConicalFrustumMeshBuilder
ConicalFrustumMeshBuilder
- frustum:bevy_math::primitives::dim3::ConicalFrustum
- resolution:u32
- segments:u32
Description
A builder used for creating a [
Mesh] with a [ConicalFrustum] shape.
Associated Functions
For function details and documentation, click on the function link.
CuboidMeshBuilder
CuboidMeshBuilder
- half_size:glam::Vec3
Description
A builder used for creating a [
Mesh] with a [Cuboid] shape.
Associated Functions
For function details and documentation, click on the function link.
CylinderAnchor
MidPoint
Top
Bottom
Description
Anchoring options for [
CylinderMeshBuilder]
Associated Functions
For function details and documentation, click on the function link.
CylinderMeshBuilder
CylinderMeshBuilder
- cylinder:bevy_math::primitives::dim3::Cylinder
- resolution:u32
- segments:u32
- caps:bool
- anchor:bevy_mesh::primitives::dim3::cylinder::CylinderAnchor
Description
A builder used for creating a [
Mesh] with a [Cylinder] shape.
Associated Functions
For function details and documentation, click on the function link.
PlaneMeshBuilder
PlaneMeshBuilder
- plane:bevy_math::primitives::dim3::Plane3d
- subdivisions:u32
Description
A builder used for creating a [
Mesh] with a [Plane3d] shape.
Associated Functions
For function details and documentation, click on the function link.
SphereKind
Ico
- subdivisions:u32
Uv
- sectors:u32
- stacks:u32
Description
A type of sphere mesh.
Associated Functions
For function details and documentation, click on the function link.
SphereMeshBuilder
SphereMeshBuilder
- sphere:bevy_math::primitives::dim3::Sphere
- kind:bevy_mesh::primitives::dim3::sphere::SphereKind
Description
A builder used for creating a [
Mesh] with an [Sphere] shape.
Associated Functions
For function details and documentation, click on the function link.
TetrahedronMeshBuilder
TetrahedronMeshBuilder
- tetrahedron:bevy_math::primitives::dim3::Tetrahedron
Description
A builder used for creating a [
Mesh] with a [Tetrahedron] shape.
Associated Functions
For function details and documentation, click on the function link.
TorusMeshBuilder
TorusMeshBuilder
- torus:bevy_math::primitives::dim3::Torus
- minor_resolution:usize
- major_resolution:usize
- angle_range:core::ops::RangeInclusive
Description
A builder used for creating a [
Mesh] with a [Torus] shape.
Associated Functions
For function details and documentation, click on the function link.
Triangle3dMeshBuilder
Triangle3dMeshBuilder
- triangle:bevy_math::primitives::dim3::Triangle3d
Description
A builder used for creating a [
Mesh] with a [Triangle3d] shape.
Associated Functions
For function details and documentation, click on the function link.
SkinnedMesh
SkinnedMesh
- inverse_bindposes:bevy_asset::handle::Handle<bevy_mesh::skinning::SkinnedMeshInverseBindposes>
- joints:alloc::vec::Vec<bevy_ecs::entity::Entity>
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
ScriptAsset
Opaque Type. 🔒
Description
Represents a script loaded into memory as an asset
Associated Functions
For function details and documentation, click on the function link.
Namespace
Global
OnType
- core::any::TypeId
Description
A namespace for functions
Associated Functions
For function details and documentation, click on the function link.
DynamicComponent
DynamicComponent
- data:bevy_mod_scripting_core::bindings::script_value::ScriptValue
Description
A dynamic script component
Associated Functions
For function details and documentation, click on the function link.
ScriptValue
Opaque Type. 🔒
Description
An abstraction of values that can be passed to and from scripts. This allows us to re-use logic between scripting languages.
Associated Functions
For function details and documentation, click on the function link.
FunctionArgInfo
FunctionArgInfo
- name:core::option::Option<alloc::borrow::Cow
> - arg_index:usize
- type_id:core::any::TypeId
Description
Information about a function argument.
Associated Functions
For function details and documentation, click on the function link.
FunctionInfo
FunctionInfo
- name:alloc::borrow::Cow
- namespace:bevy_mod_scripting_core::bindings::function::namespace::Namespace
- arg_info:alloc::vec::Vec<bevy_mod_scripting_core::docgen::info::FunctionArgInfo>
- return_info:bevy_mod_scripting_core::docgen::info::FunctionReturnInfo
- docs:core::option::Option<alloc::borrow::Cow
>
Description
Information about a function.
Associated Functions
For function details and documentation, click on the function link.
FunctionReturnInfo
FunctionReturnInfo
- type_id:core::any::TypeId
Description
Information about a function return value.
Associated Functions
For function details and documentation, click on the function link.
InteropError
Opaque Type. 🔒
Description
An error thrown when interoperating with scripting languages.
Associated Functions
For function details and documentation, click on the function link.
Atmosphere
Atmosphere
- bottom_radius:f32
- top_radius:f32
- ground_albedo:glam::Vec3
- rayleigh_density_exp_scale:f32
- rayleigh_scattering:glam::Vec3
- mie_density_exp_scale:f32
- mie_scattering:f32
- mie_absorption:f32
- mie_asymmetry:f32
- ozone_layer_altitude:f32
- ozone_layer_width:f32
- ozone_absorption:glam::Vec3
Description
This component describes the atmosphere of a planet, and when added to a camera will enable atmospheric scattering for that camera. This is only compatible with HDR cameras.
Most atmospheric particles scatter and absorb light in two main ways:
Rayleigh scattering occurs among very small particles, like individual gas molecules. It's wavelength dependent, and causes colors to separate out as light travels through the atmosphere. These particles don't absorb light.
Mie scattering occurs among slightly larger particles, like dust and sea spray. These particles do absorb light, but Mie scattering and absorption is wavelength independent.
Ozone acts differently from the other two, and is special-cased because it's very important to the look of Earth's atmosphere. It's wavelength dependent, but only absorbs light. Also, while the density of particles participating in Rayleigh and Mie scattering falls off roughly exponentially from the planet's surface, ozone only exists in a band centered at a fairly high altitude.
Associated Functions
For function details and documentation, click on the function link.
AtmosphereSettings
AtmosphereSettings
- transmittance_lut_size:glam::UVec2
- multiscattering_lut_size:glam::UVec2
- sky_view_lut_size:glam::UVec2
- aerial_view_lut_size:glam::UVec3
- transmittance_lut_samples:u32
- multiscattering_lut_dirs:u32
- multiscattering_lut_samples:u32
- sky_view_lut_samples:u32
- aerial_view_lut_samples:u32
- aerial_view_lut_max_distance:f32
- scene_units_to_m:f32
Description
This component controls the resolution of the atmosphere LUTs, and how many samples are used when computing them.
The transmittance LUT stores the transmittance from a point in the atmosphere to the outer edge of the atmosphere in any direction, parametrized by the point's radius and the cosine of the zenith angle of the ray.
The multiscattering LUT stores the factor representing luminance scattered towards the camera with scattering order >2, parametrized by the point's radius and the cosine of the zenith angle of the sun.
The sky-view lut is essentially the actual skybox, storing the light scattered towards the camera in every direction with a cubemap.
The aerial-view lut is a 3d LUT fit to the view frustum, which stores the luminance scattered towards the camera at each point (RGB channels), alongside the average transmittance to that point (A channel).
Associated Functions
For function details and documentation, click on the function link.
ClusterConfig
None
Single
XYZ
- dimensions:glam::UVec3
- z_config:bevy_pbr::cluster::ClusterZConfig
- dynamic_resizing:bool
FixedZ
- total:u32
- z_slices:u32
- z_config:bevy_pbr::cluster::ClusterZConfig
- dynamic_resizing:bool
Description
Configuration of the clustering strategy for clustered forward rendering
Associated Functions
For function details and documentation, click on the function link.
ClusterFarZMode
MaxClusterableObjectRange
Constant
- f32
Description
Configure the far z-plane mode used for the furthest depth slice for clustered forward rendering
Associated Functions
For function details and documentation, click on the function link.
ClusterZConfig
ClusterZConfig
- first_slice_depth:f32
- far_z_mode:bevy_pbr::cluster::ClusterFarZMode
Description
Configure the depth-slicing strategy for clustered forward rendering
Associated Functions
For function details and documentation, click on the function link.
CascadesVisibleEntities
CascadesVisibleEntities
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
CubemapVisibleEntities
CubemapVisibleEntities
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
VisibleMeshEntities
VisibleMeshEntities
Description
Collection of mesh entities visible for 3D lighting.
This component contains all mesh entities visible from the current light view. The collection is updated automatically by [
crate::SimulationLightSystems].
Associated Functions
For function details and documentation, click on the function link.
ClusteredDecal
ClusteredDecal
- image:bevy_asset::handle::Handle<bevy_image::image::Image>
- tag:u32
Description
An object that projects a decal onto surfaces within its bounds.
Conceptually, a clustered decal is a 1×1×1 cube centered on its origin. It projects the given [
Self::image] onto surfaces in the +Z direction (thus you may find [Transform::looking_at] useful).Clustered decals are the highest-quality types of decals that Bevy supports, but they require bindless textures. This means that they presently can't be used on WebGL 2, WebGPU, macOS, or iOS. Bevy's clustered decals can be used with forward or deferred rendering and don't require a prepass.
Associated Functions
For function details and documentation, click on the function link.
ForwardDecal
ForwardDecal
Description
A decal that renders via a 1x1 transparent quad mesh, smoothly alpha-blending with the underlying geometry towards the edges.
Because forward decals are meshes, you can use arbitrary materials to control their appearance.
Usage Notes
- Spawn this component on an entity with a [
crate::MeshMaterial3d] component holding a [ForwardDecalMaterial].- Any camera rendering a forward decal must have the [
bevy_core_pipeline::prepass::DepthPrepass] component.- Looking at forward decals at a steep angle can cause distortion. This can be mitigated by padding your decal's texture with extra transparent pixels on the edges.
Associated Functions
For function details and documentation, click on the function link.
DistanceFog
DistanceFog
- color:bevy_color::color::Color
- directional_light_color:bevy_color::color::Color
- directional_light_exponent:f32
- falloff:bevy_pbr::fog::FogFalloff
Description
Configures the “classic” computer graphics distance fog effect, in which objects appear progressively more covered in atmospheric haze the further away they are from the camera. Affects meshes rendered via the PBR
StandardMaterial.Falloff
The rate at which fog intensity increases with distance is controlled by the falloff mode. Currently, the following fog falloff modes are supported:
- [
FogFalloff::Linear]- [
FogFalloff::Exponential]- [
FogFalloff::ExponentialSquared]- [
FogFalloff::Atmospheric]Example
# use bevy_ecs::prelude::*; # use bevy_render::prelude::*; # use bevy_core_pipeline::prelude::*; # use bevy_pbr::prelude::*; # use bevy_color::Color; # fn system(mut commands: Commands) { commands.spawn(( // Setup your camera as usual Camera3d::default(), // Add fog to the same entity DistanceFog { color: Color::WHITE, falloff: FogFalloff::Exponential { density: 1e-3 }, ..Default::default() }, )); # } # bevy_ecs::system::assert_is_system(system);Material Override
Once enabled for a specific camera, the fog effect can also be disabled for individual
StandardMaterialinstances via thefog_enabledflag.
Associated Functions
For function details and documentation, click on the function link.
FogFalloff
Linear
- start:f32
- end:f32
Exponential
- density:f32
ExponentialSquared
- density:f32
Atmospheric
- extinction:glam::Vec3
- inscattering:glam::Vec3
Description
Allows switching between different fog falloff modes, and configuring their parameters.
Convenience Methods
When using non-linear fog modes it can be hard to determine the right parameter values for a given scene.
For easier artistic control, instead of creating the enum variants directly, you can use the visibility-based convenience methods:
For
FogFalloff::Exponential:
- [
FogFalloff::from_visibility()]- [
FogFalloff::from_visibility_contrast()]For
FogFalloff::ExponentialSquared:
- [
FogFalloff::from_visibility_squared()]- [
FogFalloff::from_visibility_contrast_squared()]For
FogFalloff::Atmospheric:
- [
FogFalloff::from_visibility_color()]- [
FogFalloff::from_visibility_colors()]- [
FogFalloff::from_visibility_contrast_color()]- [
FogFalloff::from_visibility_contrast_colors()]
Associated Functions
For function details and documentation, click on the function link.
Cascade
Cascade
- world_from_cascade:glam::Mat4
- clip_from_cascade:glam::Mat4
- clip_from_world:glam::Mat4
- texel_size:f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
CascadeShadowConfig
CascadeShadowConfig
- bounds:alloc::vec::Vec
- overlap_proportion:f32
- minimum_distance:f32
Description
Controls how cascaded shadow mapping works. Prefer using [
CascadeShadowConfigBuilder] to construct an instance.# use bevy_pbr::CascadeShadowConfig; # use bevy_pbr::CascadeShadowConfigBuilder; # use bevy_utils::default; # let config: CascadeShadowConfig = CascadeShadowConfigBuilder { maximum_distance: 100.0, ..default() }.into();
Associated Functions
For function details and documentation, click on the function link.
Cascades
Cascades
- cascades:bevy_ecs::entity::hash_map::EntityHashMap<alloc::vec::Vec<bevy_pbr::light::Cascade>>
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
DirectionalLightShadowMap
DirectionalLightShadowMap
- size:usize
Description
Controls the resolution of [
DirectionalLight] shadow maps.# use bevy_app::prelude::*; # use bevy_pbr::DirectionalLightShadowMap; App::new() .insert_resource(DirectionalLightShadowMap { size: 4096 });
Associated Functions
For function details and documentation, click on the function link.
NotShadowCaster
NotShadowCaster
Description
Add this component to make a [
Mesh3d] not cast shadows.
Associated Functions
For function details and documentation, click on the function link.
NotShadowReceiver
NotShadowReceiver
Description
Add this component to make a [
Mesh3d] not receive shadows.Note: If you're using diffuse transmission, setting [
NotShadowReceiver] will cause both “regular” shadows as well as diffusely transmitted shadows to be disabled, even when [TransmittedShadowReceiver] is being used.
Associated Functions
For function details and documentation, click on the function link.
PointLightShadowMap
PointLightShadowMap
- size:usize
Description
Controls the resolution of [
PointLight] shadow maps.# use bevy_app::prelude::*; # use bevy_pbr::PointLightShadowMap; App::new() .insert_resource(PointLightShadowMap { size: 2048 });
Associated Functions
For function details and documentation, click on the function link.
ShadowFilteringMethod
Hardware2x2
Gaussian
Temporal
Description
Add this component to a
Camera3dto control how to anti-alias shadow edges.The different modes use different approaches to Percentage Closer Filtering.
Associated Functions
For function details and documentation, click on the function link.
AmbientLight
AmbientLight
- color:bevy_color::color::Color
- brightness:f32
- affects_lightmapped_meshes:bool
Description
An ambient light, which lights the entire scene equally.
This resource is inserted by the [
PbrPlugin] and by default it is set to a low ambient light.It can also be added to a camera to override the resource (or default) ambient for that camera only.
Examples
Make ambient light slightly brighter:
# use bevy_ecs::system::ResMut; # use bevy_pbr::AmbientLight; fn setup_ambient_light(mut ambient_light: ResMut<AmbientLight>) { ambient_light.brightness = 100.0; }
Associated Functions
For function details and documentation, click on the function link.
DirectionalLight
DirectionalLight
- color:bevy_color::color::Color
- illuminance:f32
- shadows_enabled:bool
- affects_lightmapped_mesh_diffuse:bool
- shadow_depth_bias:f32
- shadow_normal_bias:f32
Description
A Directional light.
Directional lights don't exist in reality but they are a good approximation for light sources VERY far away, like the sun or the moon.
The light shines along the forward direction of the entity's transform. With a default transform this would be along the negative-Z axis.
Valid values for
illuminanceare:
Illuminance (lux) Surfaces illuminated by 0.0001 Moonless, overcast night sky (starlight) 0.002 Moonless clear night sky with airglow 0.05–0.3 Full moon on a clear night 3.4 Dark limit of civil twilight under a clear sky 20–50 Public areas with dark surroundings 50 Family living room lights 80 Office building hallway/toilet lighting 100 Very dark overcast day 150 Train station platforms 320–500 Office lighting 400 Sunrise or sunset on a clear day. 1000 Overcast day; typical TV studio lighting 10,000–25,000 Full daylight (not direct sun) 32,000–100,000 Direct sunlight Source: Wikipedia
Shadows
To enable shadows, set the
shadows_enabledproperty totrue.Shadows are produced via cascaded shadow maps.
To modify the cascade setup, such as the number of cascades or the maximum shadow distance, change the [
CascadeShadowConfig] component of the entity with the [DirectionalLight].To control the resolution of the shadow maps, use the [
DirectionalLightShadowMap] resource.
Associated Functions
For function details and documentation, click on the function link.
PointLight
PointLight
- color:bevy_color::color::Color
- intensity:f32
- range:f32
- radius:f32
- shadows_enabled:bool
- affects_lightmapped_mesh_diffuse:bool
- shadow_depth_bias:f32
- shadow_normal_bias:f32
- shadow_map_near_z:f32
Description
A light that emits light in all directions from a central point.
Real-world values for
intensity(luminous power in lumens) based on the electrical power consumption of the type of real-world light are:
Luminous Power (lumen) (i.e. the intensity member) Incandescent non-halogen (Watts) Incandescent halogen (Watts) Compact fluorescent (Watts) LED (Watts) 200 25 3-5 3 450 40 29 9-11 5-8 800 60 13-15 8-12 1100 75 53 18-20 10-16 1600 100 72 24-28 14-17 2400 150 30-52 24-30 3100 200 49-75 32 4000 300 75-100 40.5 Source: Wikipedia
Shadows
To enable shadows, set the
shadows_enabledproperty totrue.To control the resolution of the shadow maps, use the [
PointLightShadowMap] resource.
Associated Functions
For function details and documentation, click on the function link.
SpotLight
SpotLight
- color:bevy_color::color::Color
- intensity:f32
- range:f32
- radius:f32
- shadows_enabled:bool
- affects_lightmapped_mesh_diffuse:bool
- shadow_depth_bias:f32
- shadow_normal_bias:f32
- shadow_map_near_z:f32
- outer_angle:f32
- inner_angle:f32
Description
A light that emits light in a given direction from a central point.
Behaves like a point light in a perfectly absorbent housing that shines light only in a given direction. The direction is taken from the transform, and can be specified with
Transform::looking_at.
Associated Functions
For function details and documentation, click on the function link.
LightProbe
LightProbe
Description
A marker component for a light probe, which is a cuboid region that provides global illumination to all fragments inside it.
Note that a light probe will have no effect unless the entity contains some kind of illumination, which can either be an [
EnvironmentMapLight] or an [IrradianceVolume].The light probe range is conceptually a unit cube (1×1×1) centered on the origin. The [
Transform] applied to this entity can scale, rotate, or translate that cube so that it contains all fragments that should take this light probe into account.When multiple sources of indirect illumination can be applied to a fragment, the highest-quality one is chosen. Diffuse and specular illumination are considered separately, so, for example, Bevy may decide to sample the diffuse illumination from an irradiance volume and the specular illumination from a reflection probe. From highest priority to lowest priority, the ranking is as follows:
Rank Diffuse Specular 1 Lightmap Lightmap 2 Irradiance volume Reflection probe 3 Reflection probe View environment map 4 View environment map Note that ambient light is always added to the diffuse component and does not participate in the ranking. That is, ambient light is applied in addition to, not instead of, the light sources above.
A terminology note: Unfortunately, there is little agreement across game and graphics engines as to what to call the various techniques that Bevy groups under the term light probe. In Bevy, a light probe is the generic term that encompasses both reflection probes and irradiance volumes. In object-oriented terms, light probe is the superclass, and reflection probe and irradiance volume are subclasses. In other engines, you may see the term light probe refer to an irradiance volume with a single voxel, or perhaps some other technique, while in Bevy light probe refers not to a specific technique but rather to a class of techniques. Developers familiar with other engines should be aware of this terminology difference.
Associated Functions
For function details and documentation, click on the function link.
EnvironmentMapLight
EnvironmentMapLight
- diffuse_map:bevy_asset::handle::Handle<bevy_image::image::Image>
- specular_map:bevy_asset::handle::Handle<bevy_image::image::Image>
- intensity:f32
- rotation:glam::Quat
- affects_lightmapped_mesh_diffuse:bool
Description
A pair of cubemap textures that represent the surroundings of a specific area in space.
See [
crate::environment_map] for detailed information.
Associated Functions
For function details and documentation, click on the function link.
IrradianceVolume
IrradianceVolume
- voxels:bevy_asset::handle::Handle<bevy_image::image::Image>
- intensity:f32
- affects_lightmapped_meshes:bool
Description
The component that defines an irradiance volume.
See [
crate::irradiance_volume] for detailed information.
Associated Functions
For function details and documentation, click on the function link.
DefaultOpaqueRendererMethod
DefaultOpaqueRendererMethod
- bevy_pbr::material::OpaqueRendererMethod
Description
Default render method used for opaque materials.
Associated Functions
For function details and documentation, click on the function link.
OpaqueRendererMethod
Forward
Deferred
Auto
Description
Render method used for opaque materials.
The forward rendering main pass draws each mesh entity and shades it according to its corresponding material and the lights that affect it. Some render features like Screen Space Ambient Occlusion require running depth and normal prepasses, that are 'deferred'-like prepasses over all mesh entities to populate depth and normal textures. This means that when using render features that require running prepasses, multiple passes over all visible geometry are required. This can be slow if there is a lot of geometry that cannot be batched into few draws.
Deferred rendering runs a prepass to gather not only geometric information like depth and normals, but also all the material properties like base color, emissive color, reflectance, metalness, etc, and writes them into a deferred 'g-buffer' texture. The deferred main pass is then a fullscreen pass that reads data from these textures and executes shading. This allows for one pass over geometry, but is at the cost of not being able to use MSAA, and has heavier bandwidth usage which can be unsuitable for low end mobile or other bandwidth-constrained devices.
If a material indicates
OpaqueRendererMethod::Auto,DefaultOpaqueRendererMethodwill be used.
Associated Functions
For function details and documentation, click on the function link.
ParallaxMappingMethod
Occlusion
Relief
- max_steps:u32
Description
The parallax mapping method to use to compute depth based on the material's
depth_map.Parallax Mapping uses a depth map texture to give the illusion of depth variation on a mesh surface that is geometrically flat.
See the
parallax_mapping.wgslshader code for implementation details and explanation of the methods used.
Associated Functions
For function details and documentation, click on the function link.
StandardMaterial
StandardMaterial
- base_color:bevy_color::color::Color
- base_color_channel:bevy_pbr::pbr_material::UvChannel
- base_color_texture:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- emissive:bevy_color::linear_rgba::LinearRgba
- emissive_exposure_weight:f32
- emissive_channel:bevy_pbr::pbr_material::UvChannel
- emissive_texture:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- perceptual_roughness:f32
- metallic:f32
- metallic_roughness_channel:bevy_pbr::pbr_material::UvChannel
- metallic_roughness_texture:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- reflectance:f32
- specular_tint:bevy_color::color::Color
- diffuse_transmission:f32
- specular_transmission:f32
- thickness:f32
- ior:f32
- attenuation_distance:f32
- attenuation_color:bevy_color::color::Color
- normal_map_channel:bevy_pbr::pbr_material::UvChannel
- normal_map_texture:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- flip_normal_map_y:bool
- occlusion_channel:bevy_pbr::pbr_material::UvChannel
- occlusion_texture:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- clearcoat:f32
- clearcoat_perceptual_roughness:f32
- anisotropy_strength:f32
- anisotropy_rotation:f32
- double_sided:bool
- unlit:bool
- fog_enabled:bool
- alpha_mode:bevy_render::alpha::AlphaMode
- depth_bias:f32
- depth_map:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
- parallax_depth_scale:f32
- parallax_mapping_method:bevy_pbr::parallax::ParallaxMappingMethod
- max_parallax_layer_count:f32
- lightmap_exposure:f32
- opaque_render_method:bevy_pbr::material::OpaqueRendererMethod
- deferred_lighting_pass_id:u8
- uv_transform:glam::Affine2
Description
A material with "standard" properties used in PBR lighting. Standard property values with pictures here: https://google.github.io/filament/Material%20Properties.pdf.
May be created directly from a [
Color] or an [Image].
Associated Functions
For function details and documentation, click on the function link.
UvChannel
Uv0
Uv1
Description
An enum to define which UV attribute to use for a texture.
It is used for every texture in the [
StandardMaterial]. It only supports two UV attributes, [bevy_render::mesh::Mesh::ATTRIBUTE_UV_0] and [bevy_render::mesh::Mesh::ATTRIBUTE_UV_1]. The default is [UvChannel::Uv0].
Associated Functions
For function details and documentation, click on the function link.
ScreenSpaceAmbientOcclusion
ScreenSpaceAmbientOcclusion
- quality_level:bevy_pbr::ssao::ScreenSpaceAmbientOcclusionQualityLevel
- constant_object_thickness:f32
Description
Component to apply screen space ambient occlusion to a 3d camera.
Screen space ambient occlusion (SSAO) approximates small-scale, local occlusion of indirect diffuse light between objects, based on what's visible on-screen. SSAO does not apply to direct lighting, such as point or directional lights.
This darkens creases, e.g. on staircases, and gives nice contact shadows where objects meet, giving entities a more "grounded" feel.
Usage Notes
Requires that you add [
ScreenSpaceAmbientOcclusionPlugin] to your app.It strongly recommended that you use SSAO in conjunction with TAA ([
bevy_core_pipeline::experimental::taa::TemporalAntiAliasing]). Doing so greatly reduces SSAO noise.SSAO is not supported on
WebGL2, and is not currently supported onWebGPU.
Associated Functions
For function details and documentation, click on the function link.
ScreenSpaceAmbientOcclusionQualityLevel
Low
Medium
High
Ultra
Custom
- slice_count:u32
- samples_per_slice_side:u32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
ScreenSpaceReflections
ScreenSpaceReflections
- perceptual_roughness_threshold:f32
- thickness:f32
- linear_steps:u32
- linear_march_exponent:f32
- bisection_steps:u32
- use_secant:bool
Description
Add this component to a camera to enable screen-space reflections (SSR).
Screen-space reflections currently require deferred rendering in order to appear. Therefore, they also need the [
DepthPrepass] and [DeferredPrepass] components, which are inserted automatically.SSR currently performs no roughness filtering for glossy reflections, so only very smooth surfaces will reflect objects in screen space. You can adjust the
perceptual_roughness_thresholdin order to tune the threshold below which screen-space reflections will be traced.As with all screen-space techniques, SSR can only reflect objects on screen. When objects leave the camera, they will disappear from reflections. An alternative that doesn't suffer from this problem is the combination of a
LightProbeand [EnvironmentMapLight]. The advantage of SSR is that it can reflect all objects, not just static ones.SSR is an approximation technique and produces artifacts in some situations. Hand-tuning the settings in this component will likely be useful.
Screen-space reflections are presently unsupported on WebGL 2 because of a bug whereby Naga doesn't generate correct GLSL when sampling depth buffers, which is required for screen-space raymarching.
Associated Functions
For function details and documentation, click on the function link.
VolumetricFog
VolumetricFog
- ambient_color:bevy_color::color::Color
- ambient_intensity:f32
- jitter:f32
- step_count:u32
Description
When placed on a [
bevy_core_pipeline::core_3d::Camera3d], enables volumetric fog and volumetric lighting, also known as light shafts or god rays.
Associated Functions
For function details and documentation, click on the function link.
VolumetricLight
VolumetricLight
Description
Add this component to a
DirectionalLightwith a shadow map (shadows_enabled: true) to make volumetric fog interact with it.This allows the light to generate light shafts/god rays.
Associated Functions
For function details and documentation, click on the function link.
Pickable
Pickable
- should_block_lower:bool
- is_hoverable:bool
Description
An optional component that marks an entity as usable by a backend, and overrides default picking behavior for an entity.
This allows you to make an entity non-hoverable, or allow items below it to be hovered.
See the documentation on the fields for more details.
Associated Functions
For function details and documentation, click on the function link.
PickingPlugin
PickingPlugin
- is_enabled:bool
- is_input_enabled:bool
- is_hover_enabled:bool
- is_window_picking_enabled:bool
Description
This plugin sets up the core picking infrastructure. It receives input events, and provides the shared types used by other picking plugins.
This plugin contains several settings, and is added to the world as a resource after initialization. You can configure picking settings at runtime through the resource.
Associated Functions
For function details and documentation, click on the function link.
HitData
HitData
- camera:bevy_ecs::entity::Entity
- depth:f32
- position:core::option::Optionglam::Vec3
- normal:core::option::Optionglam::Vec3
Description
Holds data from a successful pointer hit test. See [
HitData::depth] for important details.
Associated Functions
For function details and documentation, click on the function link.
RayId
RayId
- camera:bevy_ecs::entity::Entity
- pointer:bevy_picking::pointer::PointerId
Description
Identifies a ray constructed from some (pointer, camera) combination. A pointer can be over multiple cameras, which is why a single pointer may have multiple rays.
Associated Functions
For function details and documentation, click on the function link.
PickingInteraction
Pressed
Hovered
None
Description
A component that aggregates picking interaction state of this entity across all pointers.
Unlike bevy's
Interactioncomponent, this is an aggregate of the state of all pointers interacting with this entity. Aggregation is done by taking the interaction with the highest precedence.For example, if we have an entity that is being hovered by one pointer, and pressed by another, the entity will be considered pressed. If that entity is instead being hovered by both pointers, it will be considered hovered.
Associated Functions
For function details and documentation, click on the function link.
PointerInputPlugin
PointerInputPlugin
- is_touch_enabled:bool
- is_mouse_enabled:bool
Description
Adds mouse and touch inputs for picking pointers to your app. This is a default input plugin, that you can replace with your own plugin as needed.
[
crate::PickingPlugin::is_input_enabled] can be used to toggle whether the core picking plugin processes the inputs sent by this, or other input plugins, in one place.This plugin contains several settings, and is added to the world as a resource after initialization. You can configure pointer input settings at runtime by accessing the resource.
Associated Functions
For function details and documentation, click on the function link.
PointerId
Mouse
Touch
- u64
Custom
- uuid::Uuid
Description
Identifies a unique pointer entity.
MouseandTouchpointers are automatically spawned.This component is needed because pointers can be spawned and despawned, but they need to have a stable ID that persists regardless of the Entity they are associated with.
Associated Functions
For function details and documentation, click on the function link.
PointerInteraction
PointerInteraction
- sorted_entities:alloc::vec::Vec<(bevy_ecs::entity::Entity, bevy_picking::backend::HitData)>
Description
Holds a list of entities this pointer is currently interacting with, sorted from nearest to farthest.
Associated Functions
For function details and documentation, click on the function link.
PointerLocation
PointerLocation
Description
Component that tracks a pointer's current [
Location].
Associated Functions
For function details and documentation, click on the function link.
PointerPress
PointerPress
- primary:bool
- secondary:bool
- middle:bool
Description
Tracks the state of the pointer's buttons in response to [
PointerInput] events.
Associated Functions
For function details and documentation, click on the function link.
AlphaMode
Opaque
Mask
- f32
Blend
Premultiplied
AlphaToCoverage
Add
Multiply
Description
Sets how a material's base color alpha channel is used for transparency.
Associated Functions
For function details and documentation, click on the function link.
Camera
Camera
- viewport:core::option::Option<bevy_render::camera::camera::Viewport>
- order:isize
- is_active:bool
- target:bevy_render::camera::camera::RenderTarget
- hdr:bool
- msaa_writeback:bool
- clear_color:bevy_render::camera::clear_color::ClearColorConfig
- sub_camera_view:core::option::Option<bevy_render::camera::camera::SubCameraView>
Description
The defining [
Component] for camera entities, storing information about how and what to render through this camera.The [
Camera] component is added to an entity to define the properties of the viewpoint from which rendering occurs. It defines the position of the view to render, the projection method to transform the 3D objects into a 2D image, as well as the render target into which that image is produced.Note that a [
Camera] needs a [CameraRenderGraph] to render anything. This is typically provided by adding aCamera2dorCamera3dcomponent, but custom render graphs can also be defined. Inserting a [Camera] with no render graph will emit an error at runtime.
Associated Functions
For function details and documentation, click on the function link.
CameraMainTextureUsages
Opaque Type. 🔒
Description
This component lets you control the [
TextureUsages] field of the main texture generated for the camera
Associated Functions
For function details and documentation, click on the function link.
CameraRenderGraph
Opaque Type. 🔒
Description
Configures the
RenderGraphname assigned to be run for a given [Camera] entity.
Associated Functions
For function details and documentation, click on the function link.
Exposure
Opaque Type. 🔒
Description
How much energy a
Camera3dabsorbs from incoming light.
Associated Functions
For function details and documentation, click on the function link.
ImageRenderTarget
ImageRenderTarget
- handle:bevy_asset::handle::Handle<bevy_image::image::Image>
- scale_factor:bevy_math::float_ord::FloatOrd
Description
A render target that renders to an [
Image].
Associated Functions
For function details and documentation, click on the function link.
MipBias
MipBias
- f32
Description
Camera component specifying a mip bias to apply when sampling from material textures.
Often used in conjunction with antialiasing post-process effects to reduce textures blurriness.
Associated Functions
For function details and documentation, click on the function link.
RenderTarget
Window
- bevy_window::window::WindowRef
Image
- bevy_render::camera::camera::ImageRenderTarget
TextureView
- bevy_render::camera::manual_texture_view::ManualTextureViewHandle
Description
The "target" that a [
Camera] will render to. For example, this could be a [Window] swapchain or an [Image].
Associated Functions
For function details and documentation, click on the function link.
SubCameraView
SubCameraView
- full_size:glam::UVec2
- offset:glam::Vec2
- size:glam::UVec2
Description
Settings to define a camera sub view.
When [
Camera::sub_camera_view] isSome, only the sub-section of the image defined bysizeandoffset(relative to thefull_sizeof the whole image) is projected to the cameras viewport.Take the example of the following multi-monitor setup:
┌───┬───┐ │ A │ B │ ├───┼───┤ │ C │ D │ └───┴───┘If each monitor is 1920x1080, the whole image will have a resolution of 3840x2160. For each monitor we can use a single camera with a viewport of the same size as the monitor it corresponds to. To ensure that the image is cohesive, we can use a different sub view on each camera:
- Camera A:
full_size= 3840x2160,size= 1920x1080,offset= 0,0- Camera B:
full_size= 3840x2160,size= 1920x1080,offset= 1920,0- Camera C:
full_size= 3840x2160,size= 1920x1080,offset= 0,1080- Camera D:
full_size= 3840x2160,size= 1920x1080,offset= 1920,1080However since only the ratio between the values is important, they could all be divided by 120 and still produce the same image. Camera D would for example have the following values:
full_size= 32x18,size= 16x9,offset= 16,9
Associated Functions
For function details and documentation, click on the function link.
TemporalJitter
TemporalJitter
- offset:glam::Vec2
Description
A subpixel offset to jitter a perspective camera's frustum by.
Useful for temporal rendering techniques.
Do not use with
OrthographicProjection.
Associated Functions
For function details and documentation, click on the function link.
Viewport
Viewport
- physical_position:glam::UVec2
- physical_size:glam::UVec2
- depth:core::ops::Range
Description
Render viewport configuration for the [
Camera] component.The viewport defines the area on the render target to which the camera renders its image. You can overlay multiple cameras in a single window using viewports to create effects like split screen, minimaps, and character viewers.
Associated Functions
For function details and documentation, click on the function link.
ClearColor
ClearColor
- bevy_color::color::Color
Description
A [
Resource] that stores the color that is used to clear the screen between frames.This color appears as the "background" color for simple apps, when there are portions of the screen with nothing rendered.
Associated Functions
For function details and documentation, click on the function link.
ClearColorConfig
Default
Custom
- bevy_color::color::Color
None
Description
For a camera, specifies the color used to clear the viewport before rendering.
Associated Functions
For function details and documentation, click on the function link.
ManualTextureViewHandle
ManualTextureViewHandle
- u32
Description
A unique id that corresponds to a specific [
ManualTextureView] in the [ManualTextureViews] collection.
Associated Functions
For function details and documentation, click on the function link.
CustomProjection
CustomProjection
Description
Holds a dynamic [
CameraProjection] trait object. Use [Projection::custom()] to construct a custom projection.The contained dynamic object can be downcast into a static type using [
CustomProjection::get].
Associated Functions
For function details and documentation, click on the function link.
OrthographicProjection
OrthographicProjection
- near:f32
- far:f32
- viewport_origin:glam::Vec2
- scaling_mode:bevy_render::camera::projection::ScalingMode
- scale:f32
- area:bevy_math::rects::rect::Rect
Description
Project a 3D space onto a 2D surface using parallel lines, i.e., unlike [
PerspectiveProjection], the size of objects remains the same regardless of their distance to the camera.The volume contained in the projection is called the view frustum. Since the viewport is rectangular and projection lines are parallel, the view frustum takes the shape of a cuboid.
Note that the scale of the projection and the apparent size of objects are inversely proportional. As the size of the projection increases, the size of objects decreases.
Examples
Configure the orthographic projection to one world unit per 100 window pixels:
# use bevy_render::camera::{OrthographicProjection, Projection, ScalingMode}; let projection = Projection::Orthographic(OrthographicProjection { scaling_mode: ScalingMode::WindowSize, scale: 0.01, ..OrthographicProjection::default_2d() });
Associated Functions
For function details and documentation, click on the function link.
PerspectiveProjection
PerspectiveProjection
- fov:f32
- aspect_ratio:f32
- near:f32
- far:f32
Description
A 3D camera projection in which distant objects appear smaller than close objects.
Associated Functions
For function details and documentation, click on the function link.
Projection
Perspective
- bevy_render::camera::projection::PerspectiveProjection
Orthographic
- bevy_render::camera::projection::OrthographicProjection
Custom
- bevy_render::camera::projection::CustomProjection
Description
Component that defines how to compute a
Camera's projection matrix.Common projections, like perspective and orthographic, are provided out of the box to handle the majority of use cases. Custom projections can be added using the [
CameraProjection] trait and the [Projection::custom] constructor.What's a projection?
A camera projection essentially describes how 3d points from the point of view of a camera are projected onto a 2d screen. This is where properties like a camera's field of view are defined. More specifically, a projection is a 4x4 matrix that transforms points from view space (the point of view of the camera) into clip space. Clip space is almost, but not quite, equivalent to the rectangle that is rendered to your screen, with a depth axis. Any points that land outside the bounds of this cuboid are "clipped" and not rendered.
You can also think of the projection as the thing that describes the shape of a camera's frustum: the volume in 3d space that is visible to a camera.
Associated Functions
For function details and documentation, click on the function link.
ScalingMode
WindowSize
Fixed
- width:f32
- height:f32
AutoMin
- min_width:f32
- min_height:f32
AutoMax
- max_width:f32
- max_height:f32
FixedVertical
- viewport_height:f32
FixedHorizontal
- viewport_width:f32
Description
Scaling mode for [
OrthographicProjection].The effect of these scaling modes are combined with the [
OrthographicProjection::scale] property.For example, if the scaling mode is
ScalingMode::Fixed { width: 100.0, height: 300 }and the scale is2.0, the projection will be 200 world units wide and 600 world units tall.Examples
Configure the orthographic projection to two world units per window height:
# use bevy_render::camera::{OrthographicProjection, Projection, ScalingMode}; let projection = Projection::Orthographic(OrthographicProjection { scaling_mode: ScalingMode::FixedVertical { viewport_height: 2.0 }, ..OrthographicProjection::default_2d() });
Associated Functions
For function details and documentation, click on the function link.
OcclusionCulling
OcclusionCulling
Description
Add this component to a view in order to enable experimental GPU occlusion culling.
Bevy's occlusion culling is currently marked as experimental. There are known issues whereby, in rare circumstances, occlusion culling can result in meshes being culled that shouldn't be (i.e. meshes that turn invisible). Please try it out and report issues.
Occlusion culling allows Bevy to avoid rendering objects that are fully behind other opaque or alpha tested objects. This is different from, and complements, depth fragment rejection as the
DepthPrepassenables. While depth rejection allows Bevy to avoid rendering pixels that are behind other objects, the GPU still has to examine those pixels to reject them, which requires transforming the vertices of the objects and performing skinning if the objects were skinned. Occlusion culling allows the GPU to go a step further, avoiding even transforming the vertices of objects that it can quickly prove to be behind other objects.Occlusion culling inherently has some overhead, because Bevy must examine the objects' bounding boxes, and create an acceleration structure (hierarchical Z-buffer) to perform the occlusion tests. Therefore, occlusion culling is disabled by default. Only enable it if you measure it to be a speedup on your scene. Note that, because Bevy's occlusion culling runs on the GPU and is quite efficient, it's rare for occlusion culling to result in a significant slowdown.
Occlusion culling currently requires a
DepthPrepass. If no depth prepass is present on the view, the [OcclusionCulling] component will be ignored. Additionally, occlusion culling is currently incompatible with deferred shading; including bothDeferredPrepassand [OcclusionCulling] results in unspecified behavior.The algorithm that Bevy uses is known as two-phase occlusion culling. When you enable occlusion culling, Bevy splits the depth prepass into two: an early depth prepass and a late depth prepass. The early depth prepass renders all the meshes that were visible last frame to produce a conservative approximation of the depth buffer. Then, after producing an acceleration structure known as a hierarchical Z-buffer or depth pyramid, Bevy tests the bounding boxes of all meshes against that depth buffer. Those that can be quickly proven to be behind the geometry rendered during the early depth prepass are skipped entirely. The other potentially-visible meshes are rendered during the late prepass, and finally all the visible meshes are rendered as usual during the opaque, transparent, etc. passes.
Unlike other occlusion culling systems you may be familiar with, Bevy's occlusion culling is fully dynamic and requires no baking step. The CPU overhead is minimal. Large skinned meshes and other dynamic objects can occlude other objects.
Associated Functions
For function details and documentation, click on the function link.
GlobalsUniform
GlobalsUniform
- time:f32
- delta_time:f32
- frame_count:u32
Description
Contains global values useful when writing shaders. Currently only contains values related to time.
Associated Functions
For function details and documentation, click on the function link.
Mesh2d
Mesh2d
- bevy_asset::handle::Handle<bevy_mesh::mesh::Mesh>
Description
A component for 2D meshes. Requires a
MeshMaterial2dto be rendered, commonly using aColorMaterial.Example
# use bevy_sprite::{ColorMaterial, Mesh2d, MeshMaterial2d}; # use bevy_ecs::prelude::*; # use bevy_render::mesh::Mesh; # use bevy_color::palettes::basic::RED; # use bevy_asset::Assets; # use bevy_math::primitives::Circle; # // Spawn an entity with a mesh using `ColorMaterial`. fn setup( mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<ColorMaterial>>, ) { commands.spawn(( Mesh2d(meshes.add(Circle::new(50.0))), MeshMaterial2d(materials.add(ColorMaterial::from_color(RED))), )); }
Associated Functions
For function details and documentation, click on the function link.
Mesh3d
Mesh3d
- bevy_asset::handle::Handle<bevy_mesh::mesh::Mesh>
Description
A component for 3D meshes. Requires a
MeshMaterial3dto be rendered, commonly using aStandardMaterial.Example
# use bevy_pbr::{Material, MeshMaterial3d, StandardMaterial}; # use bevy_ecs::prelude::*; # use bevy_render::mesh::{Mesh, Mesh3d}; # use bevy_color::palettes::basic::RED; # use bevy_asset::Assets; # use bevy_math::primitives::Capsule3d; # // Spawn an entity with a mesh using `StandardMaterial`. fn setup( mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<StandardMaterial>>, ) { commands.spawn(( Mesh3d(meshes.add(Capsule3d::default())), MeshMaterial3d(materials.add(StandardMaterial { base_color: RED.into(), ..Default::default() })), )); }
Associated Functions
For function details and documentation, click on the function link.
Aabb
Aabb
- center:glam::Vec3A
- half_extents:glam::Vec3A
Description
An axis-aligned bounding box, defined by:
- a center,
- the distances from the center to each faces along the axis, the faces are orthogonal to the axis.
It is typically used as a component on an entity to represent the local space occupied by this entity, with faces orthogonal to its local axis.
This component is notably used during "frustum culling", a process to determine if an entity should be rendered by a
Cameraif its bounding box intersects with the camera's [Frustum].It will be added automatically by the systems in
CalculateBoundsto entities that:
- could be subject to frustum culling, for example with a
Mesh3dorSpritecomponent,- don't have the
NoFrustumCullingcomponent.It won't be updated automatically if the space occupied by the entity changes, for example if the vertex positions of a
Mesh3dare updated.
Associated Functions
For function details and documentation, click on the function link.
CascadesFrusta
CascadesFrusta
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
CubemapFrusta
CubemapFrusta
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Frustum
Frustum
Description
A region of 3D space defined by the intersection of 6 [
HalfSpace]s.Frustums are typically an apex-truncated square pyramid (a pyramid without the top) or a cuboid.
Half spaces are ordered left, right, top, bottom, near, far. The normal vectors of the half-spaces point towards the interior of the frustum.
A frustum component is used on an entity with a
Cameracomponent to determine which entities will be considered for rendering by this camera. All entities with an [Aabb] component that are not contained by (or crossing the boundary of) the frustum will not be rendered, and not be used in rendering computations.This process is called frustum culling, and entities can opt out of it using the
NoFrustumCullingcomponent.The frustum component is typically added automatically for cameras, either
Camera2dorCamera3d. It is usually updated automatically byupdate_frustafrom theCameraProjectioncomponent andGlobalTransformof the camera entity.
Associated Functions
For function details and documentation, click on the function link.
ShaderStorageBuffer
Opaque Type. 🔒
Description
A storage buffer that is prepared as a [
RenderAsset] and uploaded to the GPU.
Associated Functions
For function details and documentation, click on the function link.
SyncToRenderWorld
SyncToRenderWorld
Description
Marker component that indicates that its entity needs to be synchronized to the render world.
This component is automatically added as a required component by
ExtractComponentPluginandSyncComponentPlugin. For more information see [SyncWorldPlugin].NOTE: This component should persist throughout the entity's entire lifecycle. If this component is removed from its entity, the entity will be despawned.
Associated Functions
For function details and documentation, click on the function link.
ColorGrading
ColorGrading
- global:bevy_render::view::ColorGradingGlobal
- shadows:bevy_render::view::ColorGradingSection
- midtones:bevy_render::view::ColorGradingSection
- highlights:bevy_render::view::ColorGradingSection
Description
Configures filmic color grading parameters to adjust the image appearance.
Color grading is applied just before tonemapping for a given
Cameraentity, with the sole exception of thepost_saturationvalue in [ColorGradingGlobal], which is applied after tonemapping.
Associated Functions
For function details and documentation, click on the function link.
ColorGradingGlobal
ColorGradingGlobal
- exposure:f32
- temperature:f32
- tint:f32
- hue:f32
- post_saturation:f32
- midtones_range:core::ops::Range
Description
Filmic color grading values applied to the image as a whole (as opposed to individual sections, like shadows and highlights).
Associated Functions
For function details and documentation, click on the function link.
ColorGradingSection
ColorGradingSection
- saturation:f32
- contrast:f32
- gamma:f32
- gain:f32
- lift:f32
Description
A section of color grading values that can be selectively applied to shadows, midtones, and highlights.
Associated Functions
For function details and documentation, click on the function link.
Msaa
Off
Sample2
Sample4
Sample8
Description
Component for configuring the number of samples for Multi-Sample Anti-Aliasing for a
Camera.Defaults to 4 samples. A higher number of samples results in smoother edges.
Some advanced rendering features may require that MSAA is disabled.
Note that the web currently only supports 1 or 4 samples.
Associated Functions
For function details and documentation, click on the function link.
InheritedVisibility
InheritedVisibility
- bool
Description
Whether or not an entity is visible in the hierarchy. This will not be accurate until
VisibilityPropagateruns in the [PostUpdate] schedule.If this is false, then [
ViewVisibility] should also be false.
Associated Functions
For function details and documentation, click on the function link.
NoFrustumCulling
NoFrustumCulling
Description
Use this component to opt-out of built-in frustum culling for entities, see [
Frustum].It can be used for example:
- when a [
Mesh] is updated but its [Aabb] is not, which might happen with animations,- when using some light effects, like wanting a [
Mesh] out of the [Frustum] to appear in the reflection of a [Mesh] within.
Associated Functions
For function details and documentation, click on the function link.
ViewVisibility
ViewVisibility
- bool
Description
Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering.
Each frame, this will be reset to
falseduringVisibilityPropagatesystems in [PostUpdate]. Later in the frame, systems inCheckVisibilitywill mark any visible entities using [ViewVisibility::set]. Because of this, values of this type will be marked as changed every frame, even when they do not change.If you wish to add custom visibility system that sets this value, make sure you add it to the
CheckVisibilityset.
Associated Functions
For function details and documentation, click on the function link.
Visibility
Inherited
Hidden
Visible
Description
User indication of whether an entity is visible. Propagates down the entity hierarchy.
If an entity is hidden in this way, all [
Children] (and all of their children and so on) who are set toInheritedwill also be hidden.This is done by the
visibility_propagate_systemwhich uses the entity hierarchy andVisibilityto set the values of each entity's [InheritedVisibility] component.
Associated Functions
For function details and documentation, click on the function link.
VisibilityClass
VisibilityClass
- smallvec::SmallVec<[core::any::TypeId; 1]>
Description
A bucket into which we group entities for the purposes of visibility.
Bevy's various rendering subsystems (3D, 2D, UI, etc.) want to be able to quickly winnow the set of entities to only those that the subsystem is tasked with rendering, to avoid spending time examining irrelevant entities. At the same time, Bevy wants the [
check_visibility] system to determine all entities' visibilities at the same time, regardless of what rendering subsystem is responsible for drawing them. Additionally, your application may want to add more types of renderable objects that Bevy determines visibility for just as it does for Bevy's built-in objects.The solution to this problem is visibility classes. A visibility class is a type, typically the type of a component, that represents the subsystem that renders it: for example,
Mesh3d,Mesh2d, andSprite. The [VisibilityClass] component stores the visibility class or classes that the entity belongs to. (Generally, an object will belong to only one visibility class, but in rare cases it may belong to multiple.)When adding a new renderable component, you'll typically want to write an add-component hook that adds the type ID of that component to the [
VisibilityClass] array. Seecustom_phase_itemfor an example.
Associated Functions
For function details and documentation, click on the function link.
VisibleEntities
VisibleEntities
Description
Collection of entities visible from the current view.
This component contains all entities which are visible from the currently rendered view. The collection is updated automatically by the [
VisibilitySystems::CheckVisibility] system set. Renderers can use the equivalent [RenderVisibleEntities] to optimize rendering of a particular view, to prevent drawing items not visible from that view.This component is intended to be attached to the same entity as the [
Camera] and the [Frustum] defining the view.
Associated Functions
For function details and documentation, click on the function link.
VisibilityRange
VisibilityRange
- start_margin:core::ops::Range
- end_margin:core::ops::Range
- use_aabb:bool
Description
Specifies the range of distances that this entity must be from the camera in order to be rendered.
This is also known as hierarchical level of detail or HLOD.
Use this component when you want to render a high-polygon mesh when the camera is close and a lower-polygon mesh when the camera is far away. This is a common technique for improving performance, because fine details are hard to see in a mesh at a distance. To avoid an artifact known as popping between levels, each level has a margin, within which the object transitions gradually from invisible to visible using a dithering effect.
You can also use this feature to replace multiple meshes with a single mesh when the camera is distant. This is the reason for the term "hierarchical level of detail". Reducing the number of meshes can be useful for reducing drawcall count. Note that you must place the [
VisibilityRange] component on each entity you want to be part of a LOD group, as [VisibilityRange] isn't automatically propagated down to children.A typical use of this feature might look like this:
Entity start_marginend_marginRoot N/A N/A ├─ High-poly mesh [0, 0) [20, 25) ├─ Low-poly mesh [20, 25) [70, 75) └─ Billboard imposter [70, 75) [150, 160) With this setup, the user will see a high-poly mesh when the camera is closer than 20 units. As the camera zooms out, between 20 units to 25 units, the high-poly mesh will gradually fade to a low-poly mesh. When the camera is 70 to 75 units away, the low-poly mesh will fade to a single textured quad. And between 150 and 160 units, the object fades away entirely. Note that the
end_marginof a higher LOD is always identical to thestart_marginof the next lower LOD; this is important for the crossfade effect to function properly.
Associated Functions
For function details and documentation, click on the function link.
RenderLayers
RenderLayers
- smallvec::SmallVec<[u64; 1]>
Description
Describes which rendering layers an entity belongs to.
Cameras with this component will only render entities with intersecting layers.
Entities may belong to one or more layers, or no layer at all.
The [
Default] instance ofRenderLayerscontains layer0, the first layer.An entity with this component without any layers is invisible.
Entities without this component belong to layer
0.
Associated Functions
For function details and documentation, click on the function link.
Screenshot
Screenshot
- bevy_render::camera::camera::RenderTarget
Description
A component that signals to the renderer to capture a screenshot this frame.
This component should be spawned on a new entity with an observer that will trigger with [
ScreenshotCaptured] when the screenshot is ready.Screenshots are captured asynchronously and may not be available immediately after the frame that the component is spawned on. The observer should be used to handle the screenshot when it is ready.
Note that the screenshot entity will be despawned after the screenshot is captured and the observer is triggered.
Usage
# use bevy_ecs::prelude::*; # use bevy_render::view::screenshot::{save_to_disk, Screenshot}; fn take_screenshot(mut commands: Commands) { commands.spawn(Screenshot::primary_window()) .observe(save_to_disk("screenshot.png")); }
Associated Functions
For function details and documentation, click on the function link.
ScreenshotCaptured
ScreenshotCaptured
- bevy_image::image::Image
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
DynamicSceneRoot
DynamicSceneRoot
- bevy_asset::handle::Handle<bevy_scene::dynamic_scene::DynamicScene>
Description
Adding this component will spawn the scene as a child of that entity. Once it's spawned, the entity will have a
SceneInstancecomponent.
Associated Functions
For function details and documentation, click on the function link.
SceneRoot
SceneRoot
- bevy_asset::handle::Handle<bevy_scene::scene::Scene>
Description
Adding this component will spawn the scene as a child of that entity. Once it's spawned, the entity will have a
SceneInstancecomponent.
Associated Functions
For function details and documentation, click on the function link.
ColorMaterial
ColorMaterial
- color:bevy_color::color::Color
- alpha_mode:bevy_sprite::mesh2d::material::AlphaMode2d
- uv_transform:glam::Affine2
- texture:core::option::Option<bevy_asset::handle::Handle<bevy_image::image::Image>>
Description
A 2d material that renders 2d meshes with a texture tinted by a uniform color
Associated Functions
For function details and documentation, click on the function link.
AlphaMode2d
Opaque
Mask
- f32
Blend
Description
Sets how a 2d material's base color alpha channel is used for transparency. Currently, this only works with [
Mesh2d]. Sprites are always transparent.This is very similar to
AlphaModebut this only applies to 2d meshes. We use a separate type because 2d doesn't support all the transparency modes that 3d does.
Associated Functions
For function details and documentation, click on the function link.
SpritePickingCamera
SpritePickingCamera
Description
An optional component that marks cameras that should be used in the [
SpritePickingPlugin].Only needed if [
SpritePickingSettings::require_markers] is set totrue, and ignored otherwise.
Associated Functions
For function details and documentation, click on the function link.
SpritePickingMode
BoundingBox
AlphaThreshold
- f32
Description
How should the [
SpritePickingPlugin] handle picking and how should it handle transparent pixels
Associated Functions
For function details and documentation, click on the function link.
SpritePickingSettings
SpritePickingSettings
- require_markers:bool
- picking_mode:bevy_sprite::picking_backend::SpritePickingMode
Description
Runtime settings for the [
SpritePickingPlugin].
Associated Functions
For function details and documentation, click on the function link.
Anchor
Center
BottomLeft
BottomCenter
BottomRight
CenterLeft
CenterRight
TopLeft
TopCenter
TopRight
Custom
- glam::Vec2
Description
How a sprite is positioned relative to its [
Transform]. It defaults toAnchor::Center.
Associated Functions
For function details and documentation, click on the function link.
ScalingMode
FillCenter
FillStart
FillEnd
FitCenter
FitStart
FitEnd
Description
Represents various modes for proportional scaling of a texture.
Can be used in [
SpriteImageMode::Scale].
Associated Functions
For function details and documentation, click on the function link.
Sprite
Sprite
- image:bevy_asset::handle::Handle<bevy_image::image::Image>
- texture_atlas:core::option::Option<bevy_image::texture_atlas::TextureAtlas>
- color:bevy_color::color::Color
- flip_x:bool
- flip_y:bool
- custom_size:core::option::Optionglam::Vec2
- rect:core::option::Option<bevy_math::rects::rect::Rect>
- anchor:bevy_sprite::sprite::Anchor
- image_mode:bevy_sprite::sprite::SpriteImageMode
Description
Describes a sprite to be rendered to a 2D camera
Associated Functions
For function details and documentation, click on the function link.
SpriteImageMode
Auto
Scale
- bevy_sprite::sprite::ScalingMode
Sliced
- bevy_sprite::texture_slice::slicer::TextureSlicer
Tiled
- tile_x:bool
- tile_y:bool
- stretch_value:f32
Description
Controls how the image is altered when scaled.
Associated Functions
For function details and documentation, click on the function link.
BorderRect
BorderRect
- left:f32
- right:f32
- top:f32
- bottom:f32
Description
Defines the extents of the border of a rectangle.
This struct is used to represent thickness or offsets from the edges of a rectangle (left, right, top, and bottom), with values increasing inwards.
Associated Functions
For function details and documentation, click on the function link.
SliceScaleMode
Stretch
Tile
- stretch_value:f32
Description
Defines how a texture slice scales when resized
Associated Functions
For function details and documentation, click on the function link.
TextureSlicer
TextureSlicer
- border:bevy_sprite::texture_slice::border_rect::BorderRect
- center_scale_mode:bevy_sprite::texture_slice::slicer::SliceScaleMode
- sides_scale_mode:bevy_sprite::texture_slice::slicer::SliceScaleMode
- max_corner_scale:f32
Description
Slices a texture using the 9-slicing technique. This allows to reuse an image at various sizes without needing to prepare multiple assets. The associated texture will be split into nine portions, so that on resize the different portions scale or tile in different ways to keep the texture in proportion.
For example, when resizing a 9-sliced texture the corners will remain unscaled while the other sections will be scaled or tiled.
See 9-sliced textures.
Associated Functions
For function details and documentation, click on the function link.
ReflectableScheduleLabel
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
TextBounds
TextBounds
- width:core::option::Option
- height:core::option::Option
Description
The maximum width and height of text. The text will wrap according to the specified size.
Characters out of the bounds after wrapping will be truncated. Text is aligned according to the specified
JustifyText.Note: only characters that are completely out of the bounds will be truncated, so this is not a reliable limit if it is necessary to contain the text strictly in the bounds. Currently this component is mainly useful for text wrapping only.
Associated Functions
For function details and documentation, click on the function link.
GlyphAtlasInfo
GlyphAtlasInfo
- texture:bevy_asset::handle::Handle<bevy_image::image::Image>
- texture_atlas:bevy_asset::handle::Handle<bevy_image::texture_atlas::TextureAtlasLayout>
- location:bevy_text::glyph::GlyphAtlasLocation
Description
Information about a glyph in an atlas.
Rasterized glyphs are stored as rectangles in one or more
FontAtlases.Used in [
PositionedGlyph] andFontAtlasSet.
Associated Functions
For function details and documentation, click on the function link.
GlyphAtlasLocation
GlyphAtlasLocation
- glyph_index:usize
- offset:glam::IVec2
Description
The location of a glyph in an atlas, and how it should be positioned when placed.
Used in [
GlyphAtlasInfo] andFontAtlas.
Associated Functions
For function details and documentation, click on the function link.
PositionedGlyph
PositionedGlyph
- position:glam::Vec2
- size:glam::Vec2
- atlas_info:bevy_text::glyph::GlyphAtlasInfo
- span_index:usize
- line_index:usize
- byte_index:usize
- byte_length:usize
Description
A glyph of a font, typically representing a single character, positioned in screen space.
Contains information about how and where to render a glyph.
Used in
TextPipeline::queue_textand [crate::TextLayoutInfo] for rendering glyphs.
Associated Functions
For function details and documentation, click on the function link.
TextLayoutInfo
TextLayoutInfo
- glyphs:alloc::vec::Vec<bevy_text::glyph::PositionedGlyph>
- size:glam::Vec2
Description
Render information for a corresponding text block.
Contains scaled glyphs and their size. Generated via [
TextPipeline::queue_text] when an entity has [TextLayout] and [ComputedTextBlock] components.
Associated Functions
For function details and documentation, click on the function link.
Text2d
Text2d
- String
Description
The top-level 2D text component.
Adding
Text2dto an entity will pull in required components for setting up 2d text. Example usage.The string in this component is the first 'text span' in a hierarchy of text spans that are collected into a [
ComputedTextBlock]. SeeTextSpanfor the component used by children of entities with [Text2d].With
Text2dthejustifyfield of [TextLayout] only affects the internal alignment of a block of text and not its relative position, which is controlled by the [Anchor] component. This means that for a block of text consisting of only one line that doesn't wrap, thejustifyfield will have no effect.# use bevy_asset::Handle; # use bevy_color::Color; # use bevy_color::palettes::basic::BLUE; # use bevy_ecs::world::World; # use bevy_text::{Font, JustifyText, Text2d, TextLayout, TextFont, TextColor, TextSpan}; # # let font_handle: Handle<Font> = Default::default(); # let mut world = World::default(); # // Basic usage. world.spawn(Text2d::new("hello world!")); // With non-default style. world.spawn(( Text2d::new("hello world!"), TextFont { font: font_handle.clone().into(), font_size: 60.0, ..Default::default() }, TextColor(BLUE.into()), )); // With text justification. world.spawn(( Text2d::new("hello world\nand bevy!"), TextLayout::new_with_justify(JustifyText::Center) )); // With spans world.spawn(Text2d::new("hello ")).with_children(|parent| { parent.spawn(TextSpan::new("world")); parent.spawn((TextSpan::new("!"), TextColor(BLUE.into()))); });
Associated Functions
For function details and documentation, click on the function link.
ComputedTextBlock
ComputedTextBlock
- entities:smallvec::SmallVec<[bevy_text::text::TextEntity; 1]>
- needs_rerender:bool
Description
Computed information for a text block.
See [
TextLayout].Automatically updated by 2d and UI text systems.
Associated Functions
For function details and documentation, click on the function link.
FontSmoothing
None
AntiAliased
Description
Determines which antialiasing method to use when rendering text. By default, text is rendered with grayscale antialiasing, but this can be changed to achieve a pixelated look.
Note: Subpixel antialiasing is not currently supported.
Associated Functions
For function details and documentation, click on the function link.
JustifyText
Left
Center
Right
Justified
Description
Describes the horizontal alignment of multiple lines of text relative to each other.
This only affects the internal positioning of the lines of text within a text entity and does not affect the text entity's position.
Has no affect on a single line text entity, unless used together with a
TextBoundscomponent with an explicitwidthvalue.
Associated Functions
For function details and documentation, click on the function link.
LineBreak
WordBoundary
AnyCharacter
WordOrCharacter
NoWrap
Description
Determines how lines will be broken when preventing text from running out of bounds.
Associated Functions
For function details and documentation, click on the function link.
LineHeight
Px
- f32
RelativeToFont
- f32
Description
Specifies the height of each line of text for
TextandText2dDefault is 1.2x the font size
Associated Functions
For function details and documentation, click on the function link.
TextColor
TextColor
- bevy_color::color::Color
Description
The color of the text for this section.
Associated Functions
For function details and documentation, click on the function link.
TextEntity
TextEntity
- entity:bevy_ecs::entity::Entity
- depth:usize
Description
A sub-entity of a [
ComputedTextBlock].Returned by [
ComputedTextBlock::entities].
Associated Functions
For function details and documentation, click on the function link.
TextFont
TextFont
- font:bevy_asset::handle::Handle<bevy_text::font::Font>
- font_size:f32
- line_height:bevy_text::text::LineHeight
- font_smoothing:bevy_text::text::FontSmoothing
Description
TextFontdetermines the style of a text span within a [ComputedTextBlock], specifically the font face, the font size, and the color.
Associated Functions
For function details and documentation, click on the function link.
TextLayout
TextLayout
- justify:bevy_text::text::JustifyText
- linebreak:bevy_text::text::LineBreak
Description
Component with text format settings for a block of text.
A block of text is composed of text spans, which each have a separate string value and [
TextFont]. Text spans associated with a text block are collected into [ComputedTextBlock] for layout, and then inserted to [TextLayoutInfo] for rendering.See
Text2dfor the core component of 2d text, andTextinbevy_uifor UI text.
Associated Functions
For function details and documentation, click on the function link.
TextSpan
TextSpan
- String
Description
A span of text in a tree of spans.
TextSpanis only valid as a child of an entity with [TextLayout], which is provided byTextfor text inbevy_uiorText2dfor text in 2d world-space.Spans are collected in hierarchy traversal order into a [
ComputedTextBlock] for layout.# use bevy_asset::Handle; # use bevy_color::Color; # use bevy_color::palettes::basic::{RED, BLUE}; # use bevy_ecs::world::World; # use bevy_text::{Font, TextLayout, TextFont, TextSpan, TextColor}; # let font_handle: Handle<Font> = Default::default(); # let mut world = World::default(); # world.spawn(( // `Text` or `Text2d` are needed, and will provide default instances // of the following components. TextLayout::default(), TextFont { font: font_handle.clone().into(), font_size: 60.0, ..Default::default() }, TextColor(BLUE.into()), )) .with_child(( // Children must be `TextSpan`, not `Text` or `Text2d`. TextSpan::new("Hello!"), TextFont { font: font_handle.into(), font_size: 60.0, ..Default::default() }, TextColor(RED.into()), ));
Associated Functions
For function details and documentation, click on the function link.
UiScale
UiScale
- f32
Description
The current scale of the UI.
A multiplier to fixed-sized ui values. Note: This will only affect fixed ui values like [
Val::Px]
Associated Functions
For function details and documentation, click on the function link.
FocusPolicy
Block
Pass
Description
Describes whether the node should block interactions with lower nodes
Associated Functions
For function details and documentation, click on the function link.
Interaction
Pressed
Hovered
None
Description
Describes what type of input interaction has occurred for a UI node.
This is commonly queried with a
Changed<Interaction>filter.Updated in [
ui_focus_system].If a UI node has both [
Interaction] and [InheritedVisibility] components, [Interaction] will always be [Interaction::None] when [InheritedVisibility::get()] is false. This ensures that hidden UI nodes are not interactable, and do not end up stuck in an active state if hidden at the wrong time.Note that you can also control the visibility of a node using the
Displayproperty, which fully collapses it during layout calculations.See also
Buttonwhich requires this component- [
RelativeCursorPosition] to obtain the position of the cursor relative to current node
Associated Functions
For function details and documentation, click on the function link.
RelativeCursorPosition
RelativeCursorPosition
- normalized_visible_node_rect:bevy_math::rects::rect::Rect
- normalized:core::option::Optionglam::Vec2
Description
A component storing the position of the mouse relative to the node, (0., 0.) being the top-left corner and (1., 1.) being the bottom-right If the mouse is not over the node, the value will go beyond the range of (0., 0.) to (1., 1.)
It can be used alongside [
Interaction] to get the position of the press.The component is updated when it is in the same entity with
Node.
Associated Functions
For function details and documentation, click on the function link.
UiRect
UiRect
- left:bevy_ui::geometry::Val
- right:bevy_ui::geometry::Val
- top:bevy_ui::geometry::Val
- bottom:bevy_ui::geometry::Val
Description
A type which is commonly used to define margins, paddings and borders.
Examples
Margin
A margin is used to create space around UI elements, outside of any defined borders.
# use bevy_ui::{UiRect, Val}; # let margin = UiRect::all(Val::Auto); // Centers the UI elementPadding
A padding is used to create space around UI elements, inside of any defined borders.
# use bevy_ui::{UiRect, Val}; # let padding = UiRect { left: Val::Px(10.0), right: Val::Px(20.0), top: Val::Px(30.0), bottom: Val::Px(40.0), };Borders
A border is used to define the width of the border of a UI element.
# use bevy_ui::{UiRect, Val}; # let border = UiRect { left: Val::Px(10.0), right: Val::Px(20.0), top: Val::Px(30.0), bottom: Val::Px(40.0), };
Associated Functions
For function details and documentation, click on the function link.
Val
Auto
Px
- f32
Percent
- f32
Vw
- f32
Vh
- f32
VMin
- f32
VMax
- f32
Description
Represents the possible value types for layout properties.
This enum allows specifying values for various
Nodeproperties in different units, such as logical pixels, percentages, or automatically determined values.
Valalso implements [core::str::FromStr] to allow parsing values from strings in the format#.#px. Whitespaces between the value and unit is allowed. The following units are supported:
px: logical pixels%: percentagevw: percentage of the viewport widthvh: percentage of the viewport heightvmin: percentage of the viewport's smaller dimensionvmax: percentage of the viewport's larger dimensionAdditionally,
autowill be parsed as [Val::Auto].
Associated Functions
For function details and documentation, click on the function link.
ContentSize
ContentSize
Description
A node with a
ContentSizecomponent is a node where its size is based on its content.
Associated Functions
For function details and documentation, click on the function link.
UiPickingCamera
UiPickingCamera
Description
An optional component that marks cameras that should be used in the [
UiPickingPlugin].Only needed if [
UiPickingSettings::require_markers] is set totrue, and ignored otherwise.
Associated Functions
For function details and documentation, click on the function link.
UiPickingSettings
UiPickingSettings
- require_markers:bool
Description
Runtime settings for the [
UiPickingPlugin].
Associated Functions
For function details and documentation, click on the function link.
AlignContent
Default
Start
End
FlexStart
FlexEnd
Center
Stretch
SpaceBetween
SpaceEvenly
SpaceAround
Description
Used to control how items are distributed.
- For Flexbox containers, controls alignment of lines if
flex_wrapis set to [FlexWrap::Wrap] and there are multiple lines of items.- For CSS Grid containers, controls alignment of grid rows.
https://developer.mozilla.org/en-US/docs/Web/CSS/align-content
Associated Functions
For function details and documentation, click on the function link.
AlignItems
Default
Start
End
FlexStart
FlexEnd
Center
Baseline
Stretch
Description
Used to control how each individual item is aligned by default within the space they're given.
- For Flexbox containers, sets default cross axis alignment of the child items.
- For CSS Grid containers, controls block (vertical) axis alignment of children of this grid container within their grid areas.
https://developer.mozilla.org/en-US/docs/Web/CSS/align-items
Associated Functions
For function details and documentation, click on the function link.
AlignSelf
Auto
Start
End
FlexStart
FlexEnd
Center
Baseline
Stretch
Description
Used to control how the specified item is aligned within the space it's given.
- For Flexbox items, controls cross axis alignment of the item.
- For CSS Grid items, controls block (vertical) axis alignment of a grid item within its grid area.
Associated Functions
For function details and documentation, click on the function link.
BackgroundColor
BackgroundColor
- bevy_color::color::Color
Description
The background color of the node
This serves as the "fill" color.
Associated Functions
For function details and documentation, click on the function link.
BorderColor
BorderColor
- bevy_color::color::Color
Description
The border color of the UI node.
Associated Functions
For function details and documentation, click on the function link.
BorderRadius
BorderRadius
- top_left:bevy_ui::geometry::Val
- top_right:bevy_ui::geometry::Val
- bottom_left:bevy_ui::geometry::Val
- bottom_right:bevy_ui::geometry::Val
Description
Used to add rounded corners to a UI node. You can set a UI node to have uniformly rounded corners or specify different radii for each corner. If a given radius exceeds half the length of the smallest dimension between the node's height or width, the radius will calculated as half the smallest dimension.
Elliptical nodes are not supported yet. Percentage values are based on the node's smallest dimension, either width or height.
Example
#![allow(unused)] fn main() { use bevy_ecs::prelude::*; use bevy_ui::prelude::*; use bevy_color::palettes::basic::{BLUE}; fn setup_ui(mut commands: Commands) { commands.spawn(( Node { width: Val::Px(100.), height: Val::Px(100.), border: UiRect::all(Val::Px(2.)), ..Default::default() }, BackgroundColor(BLUE.into()), BorderRadius::new( // top left Val::Px(10.), // top right Val::Px(20.), // bottom right Val::Px(30.), // bottom left Val::Px(40.), ), )); } }https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius
Associated Functions
For function details and documentation, click on the function link.
BoxShadow
BoxShadow
- alloc::vec::Vec<bevy_ui::ui_node::ShadowStyle>
Description
List of shadows to draw for a [
Node].Draw order is determined implicitly from the vector of [
ShadowStyle]s, back-to-front.
Associated Functions
For function details and documentation, click on the function link.
BoxShadowSamples
BoxShadowSamples
- u32
Description
Number of shadow samples. A larger value will result in higher quality shadows. Default is 4, values higher than ~10 offer diminishing returns.
use bevy_core_pipeline::prelude::*; use bevy_ecs::prelude::*; use bevy_ui::prelude::*; fn spawn_camera(mut commands: Commands) { commands.spawn(( Camera2d, BoxShadowSamples(6), )); }
Associated Functions
For function details and documentation, click on the function link.
BoxSizing
BorderBox
ContentBox
Description
Which part of a Node's box length styles like width and height control
See: https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
Associated Functions
For function details and documentation, click on the function link.
CalculatedClip
CalculatedClip
- clip:bevy_math::rects::rect::Rect
Description
The calculated clip of the node
Associated Functions
For function details and documentation, click on the function link.
ComputedNode
ComputedNode
- stack_index:u32
- size:glam::Vec2
- content_size:glam::Vec2
- outline_width:f32
- outline_offset:f32
- unrounded_size:glam::Vec2
- border:bevy_sprite::texture_slice::border_rect::BorderRect
- border_radius:bevy_ui::ui_node::ResolvedBorderRadius
- padding:bevy_sprite::texture_slice::border_rect::BorderRect
- inverse_scale_factor:f32
Description
Provides the computed size and layout properties of the node.
Fields in this struct are public but should not be modified under most circumstances. For example, in a scrollbar you may want to derive the handle's size from the proportion of scrollable content in-view. You can directly modify
ComputedNodeafter layout to set the handle size without any delays.
Associated Functions
For function details and documentation, click on the function link.
ComputedNodeTarget
ComputedNodeTarget
- camera:bevy_ecs::entity::Entity
- scale_factor:f32
- physical_size:glam::UVec2
Description
Derived information about the camera target for this UI node.
Associated Functions
For function details and documentation, click on the function link.
Display
Flex
Grid
Block
None
Description
Defines the layout model used by this node.
Part of the [
Node] component.
Associated Functions
For function details and documentation, click on the function link.
FlexDirection
Row
Column
RowReverse
ColumnReverse
Description
Defines how flexbox items are ordered within a flexbox
Associated Functions
For function details and documentation, click on the function link.
FlexWrap
NoWrap
Wrap
WrapReverse
Description
Defines if flexbox items appear on a single line or on multiple lines
Associated Functions
For function details and documentation, click on the function link.
GridAutoFlow
Row
Column
RowDense
ColumnDense
Description
Controls whether grid items are placed row-wise or column-wise as well as whether the sparse or dense packing algorithm is used.
The "dense" packing algorithm attempts to fill in holes earlier in the grid, if smaller items come up later. This may cause items to appear out-of-order when doing so would fill in holes left by larger items.
Defaults to [
GridAutoFlow::Row].https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow
Associated Functions
For function details and documentation, click on the function link.
GridPlacement
GridPlacement
- start:core::option::Optioncore::num::NonZeroI16
- span:core::option::Optioncore::num::NonZeroU16
- end:core::option::Optioncore::num::NonZeroI16
Description
Represents the position of a grid item in a single axis.
There are 3 fields which may be set:
start: which grid line the item should start atend: which grid line the item should end atspan: how many tracks the item should spanThe default
spanis 1. If neitherstartorendis set then the item will be placed automatically.Generally, at most two fields should be set. If all three fields are specified then
spanwill be ignored. Ifendspecifies an earlier grid line thanstartthenendwill be ignored and the item will have a span of 1.https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout/Line-based_Placement_with_CSS_Grid
Associated Functions
For function details and documentation, click on the function link.
GridTrack
GridTrack
- min_sizing_function:bevy_ui::ui_node::MinTrackSizingFunction
- max_sizing_function:bevy_ui::ui_node::MaxTrackSizingFunction
Description
A [
GridTrack] is a Row or Column of a CSS Grid. This struct specifies what size the track should be. See below for the different "track sizing functions" you can specify.
Associated Functions
For function details and documentation, click on the function link.
GridTrackRepetition
Count
- u16
AutoFill
AutoFit
Description
How many times to repeat a repeated grid track
Associated Functions
For function details and documentation, click on the function link.
JustifyContent
Default
Start
End
FlexStart
FlexEnd
Center
Stretch
SpaceBetween
SpaceEvenly
SpaceAround
Description
Used to control how items are distributed.
- For Flexbox containers, controls alignment of items in the main axis.
- For CSS Grid containers, controls alignment of grid columns.
https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content
Associated Functions
For function details and documentation, click on the function link.
JustifyItems
Default
Start
End
Center
Baseline
Stretch
Description
Used to control how each individual item is aligned by default within the space they're given.
- For Flexbox containers, this property has no effect. See
justify_contentfor main axis alignment of flex items.- For CSS Grid containers, sets default inline (horizontal) axis alignment of child items within their grid areas.
https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items
Associated Functions
For function details and documentation, click on the function link.
JustifySelf
Auto
Start
End
Center
Baseline
Stretch
Description
Used to control how the specified item is aligned within the space it's given.
- For Flexbox items, this property has no effect. See
justify_contentfor main axis alignment of flex items.- For CSS Grid items, controls inline (horizontal) axis alignment of a grid item within its grid area.
https://developer.mozilla.org/en-US/docs/Web/CSS/justify-self
Associated Functions
For function details and documentation, click on the function link.
MaxTrackSizingFunction
Px
- f32
Percent
- f32
MinContent
MaxContent
FitContentPx
- f32
FitContentPercent
- f32
Auto
Fraction
- f32
VMin
- f32
VMax
- f32
Vh
- f32
Vw
- f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
MinTrackSizingFunction
Px
- f32
Percent
- f32
MinContent
MaxContent
Auto
VMin
- f32
VMax
- f32
Vh
- f32
Vw
- f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Node
Node
- display:bevy_ui::ui_node::Display
- box_sizing:bevy_ui::ui_node::BoxSizing
- position_type:bevy_ui::ui_node::PositionType
- overflow:bevy_ui::ui_node::Overflow
- overflow_clip_margin:bevy_ui::ui_node::OverflowClipMargin
- left:bevy_ui::geometry::Val
- right:bevy_ui::geometry::Val
- top:bevy_ui::geometry::Val
- bottom:bevy_ui::geometry::Val
- width:bevy_ui::geometry::Val
- height:bevy_ui::geometry::Val
- min_width:bevy_ui::geometry::Val
- min_height:bevy_ui::geometry::Val
- max_width:bevy_ui::geometry::Val
- max_height:bevy_ui::geometry::Val
- aspect_ratio:core::option::Option
- align_items:bevy_ui::ui_node::AlignItems
- justify_items:bevy_ui::ui_node::JustifyItems
- align_self:bevy_ui::ui_node::AlignSelf
- justify_self:bevy_ui::ui_node::JustifySelf
- align_content:bevy_ui::ui_node::AlignContent
- justify_content:bevy_ui::ui_node::JustifyContent
- margin:bevy_ui::geometry::UiRect
- padding:bevy_ui::geometry::UiRect
- border:bevy_ui::geometry::UiRect
- flex_direction:bevy_ui::ui_node::FlexDirection
- flex_wrap:bevy_ui::ui_node::FlexWrap
- flex_grow:f32
- flex_shrink:f32
- flex_basis:bevy_ui::geometry::Val
- row_gap:bevy_ui::geometry::Val
- column_gap:bevy_ui::geometry::Val
- grid_auto_flow:bevy_ui::ui_node::GridAutoFlow
- grid_template_rows:alloc::vec::Vec<bevy_ui::ui_node::RepeatedGridTrack>
- grid_template_columns:alloc::vec::Vec<bevy_ui::ui_node::RepeatedGridTrack>
- grid_auto_rows:alloc::vec::Vec<bevy_ui::ui_node::GridTrack>
- grid_auto_columns:alloc::vec::Vec<bevy_ui::ui_node::GridTrack>
- grid_row:bevy_ui::ui_node::GridPlacement
- grid_column:bevy_ui::ui_node::GridPlacement
Description
The base component for UI entities. It describes UI layout and style properties.
When defining new types of UI entities, require [
Node] to make them behave like UI nodes.Nodes can be laid out using either Flexbox or CSS Grid Layout.
See below for general learning resources and for documentation on the individual style properties.
Flexbox
- MDN: Basic Concepts of Flexbox
- A Complete Guide To Flexbox by CSS Tricks. This is detailed guide with illustrations and comprehensive written explanation of the different Flexbox properties and how they work.
- Flexbox Froggy. An interactive tutorial/game that teaches the essential parts of Flexbox in a fun engaging way.
CSS Grid
- MDN: Basic Concepts of Grid Layout
- A Complete Guide To CSS Grid by CSS Tricks. This is detailed guide with illustrations and comprehensive written explanation of the different CSS Grid properties and how they work.
- CSS Grid Garden. An interactive tutorial/game that teaches the essential parts of CSS Grid in a fun engaging way.
See also
RelativeCursorPositionto obtain the cursor position relative to this nodeInteractionto obtain the interaction state of this node
Associated Functions
For function details and documentation, click on the function link.
Outline
Outline
- width:bevy_ui::geometry::Val
- offset:bevy_ui::geometry::Val
- color:bevy_color::color::Color
Description
The [
Outline] component adds an outline outside the edge of a UI node. Outlines do not take up space in the layout.To add an [
Outline] to a ui node you can spawn a(Node, Outline)tuple bundle:# use bevy_ecs::prelude::*; # use bevy_ui::prelude::*; # use bevy_color::palettes::basic::{RED, BLUE}; fn setup_ui(mut commands: Commands) { commands.spawn(( Node { width: Val::Px(100.), height: Val::Px(100.), ..Default::default() }, BackgroundColor(BLUE.into()), Outline::new(Val::Px(10.), Val::ZERO, RED.into()) )); }[
Outline] components can also be added later to existing UI nodes:# use bevy_ecs::prelude::*; # use bevy_ui::prelude::*; # use bevy_color::Color; fn outline_hovered_button_system( mut commands: Commands, mut node_query: Query<(Entity, &Interaction, Option<&mut Outline>), Changed<Interaction>>, ) { for (entity, interaction, mut maybe_outline) in node_query.iter_mut() { let outline_color = if matches!(*interaction, Interaction::Hovered) { Color::WHITE } else { Color::NONE }; if let Some(mut outline) = maybe_outline { outline.color = outline_color; } else { commands.entity(entity).insert(Outline::new(Val::Px(10.), Val::ZERO, outline_color)); } } }Inserting and removing an [
Outline] component repeatedly will result in table moves, so it is generally preferable to setOutline::colorto [Color::NONE] to hide an outline.
Associated Functions
For function details and documentation, click on the function link.
Overflow
Overflow
- x:bevy_ui::ui_node::OverflowAxis
- y:bevy_ui::ui_node::OverflowAxis
Description
Whether to show or hide overflowing items
Associated Functions
For function details and documentation, click on the function link.
OverflowAxis
Visible
Clip
Hidden
Scroll
Description
Whether to show or hide overflowing items
Associated Functions
For function details and documentation, click on the function link.
OverflowClipBox
ContentBox
PaddingBox
BorderBox
Description
Used to determine the bounds of the visible area when a UI node is clipped.
Associated Functions
For function details and documentation, click on the function link.
OverflowClipMargin
OverflowClipMargin
- visual_box:bevy_ui::ui_node::OverflowClipBox
- margin:f32
Description
The bounds of the visible area when a UI node is clipped.
Associated Functions
For function details and documentation, click on the function link.
PositionType
Relative
Absolute
Description
The strategy used to position this node
Associated Functions
For function details and documentation, click on the function link.
RepeatedGridTrack
RepeatedGridTrack
- repetition:bevy_ui::ui_node::GridTrackRepetition
- tracks:smallvec::SmallVec<[bevy_ui::ui_node::GridTrack; 1]>
Description
Represents a possibly repeated [
GridTrack].The repetition parameter can either be:
- The integer
1, in which case the track is non-repeated.- a
u16count to repeat the track N times.- A
GridTrackRepetition::AutoFitorGridTrackRepetition::AutoFill.Note: that in the common case you want a non-repeating track (repetition count 1), you may use the constructor methods on [
GridTrack] to create aRepeatedGridTrack. i.e.GridTrack::px(10.0)is equivalent toRepeatedGridTrack::px(1, 10.0).You may only use one auto-repetition per track list. And if your track list contains an auto repetition then all tracks (in and outside of the repetition) must be fixed size (px or percent). Integer repetitions are just shorthand for writing out N tracks longhand and are not subject to the same limitations.
Associated Functions
For function details and documentation, click on the function link.
ResolvedBorderRadius
ResolvedBorderRadius
- top_left:f32
- top_right:f32
- bottom_left:f32
- bottom_right:f32
Description
Represents the resolved border radius values for a UI node.
The values are in physical pixels.
Associated Functions
For function details and documentation, click on the function link.
ScrollPosition
ScrollPosition
- offset_x:f32
- offset_y:f32
Description
The scroll position of the node.
Updating the values of
ScrollPositionwill reposition the children of the node by the offset amount.ScrollPositionmay be updated by the layout system when a layout change makes a previously validScrollPositioninvalid. Changing this does nothing on aNodewithout setting at least oneOverflowAxistoOverflowAxis::Scroll.
Associated Functions
For function details and documentation, click on the function link.
ShadowStyle
ShadowStyle
- color:bevy_color::color::Color
- x_offset:bevy_ui::geometry::Val
- y_offset:bevy_ui::geometry::Val
- spread_radius:bevy_ui::geometry::Val
- blur_radius:bevy_ui::geometry::Val
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
TextShadow
TextShadow
- offset:glam::Vec2
- color:bevy_color::color::Color
Description
Adds a shadow behind text
Associated Functions
For function details and documentation, click on the function link.
UiAntiAlias
On
Off
Description
Marker for controlling whether Ui is rendered with or without anti-aliasing in a camera. By default, Ui is always anti-aliased.
Note: This does not affect text anti-aliasing. For that, use the
font_smoothingproperty of theTextFontcomponent.use bevy_core_pipeline::prelude::*; use bevy_ecs::prelude::*; use bevy_ui::prelude::*; fn spawn_camera(mut commands: Commands) { commands.spawn(( Camera2d, // This will cause all Ui in this camera to be rendered without // anti-aliasing UiAntiAlias::Off, )); }
Associated Functions
For function details and documentation, click on the function link.
UiTargetCamera
UiTargetCamera
- bevy_ecs::entity::Entity
Description
Indicates that this root [
Node] entity should be rendered to a specific camera.UI then will be laid out respecting the camera's viewport and scale factor, and rendered to this camera's [
bevy_render::camera::RenderTarget].Setting this component on a non-root node will have no effect. It will be overridden by the root node's component.
Root node's without an explicit [
UiTargetCamera] will be rendered to the default UI camera, which is either a single camera with the [IsDefaultUiCamera] marker component or the highest order camera targeting the primary window.
Associated Functions
For function details and documentation, click on the function link.
ZIndex
ZIndex
- i32
Description
Indicates that this [
Node] entity's front-to-back ordering is not controlled solely by its location in the UI hierarchy. A node with a higher z-index will appear on top of sibling nodes with a lower z-index.UI nodes that have the same z-index will appear according to the order in which they appear in the UI hierarchy. In such a case, the last node to be added to its parent will appear in front of its siblings.
Nodes without this component will be treated as if they had a value of [
ZIndex(0)].Use [
GlobalZIndex] if you need to order separate UI hierarchies or nodes that are not siblings in a given UI hierarchy.
Associated Functions
For function details and documentation, click on the function link.
Button
Button
Description
Marker struct for buttons
Associated Functions
For function details and documentation, click on the function link.
ImageNode
ImageNode
- color:bevy_color::color::Color
- image:bevy_asset::handle::Handle<bevy_image::image::Image>
- texture_atlas:core::option::Option<bevy_image::texture_atlas::TextureAtlas>
- flip_x:bool
- flip_y:bool
- rect:core::option::Option<bevy_math::rects::rect::Rect>
- image_mode:bevy_ui::widget::image::NodeImageMode
Description
A UI Node that renders an image.
Associated Functions
For function details and documentation, click on the function link.
ImageNodeSize
ImageNodeSize
- size:glam::UVec2
Description
The size of the image's texture
This component is updated automatically by [
update_image_content_size_system]
Associated Functions
For function details and documentation, click on the function link.
NodeImageMode
Auto
Stretch
Sliced
- bevy_sprite::texture_slice::slicer::TextureSlicer
Tiled
- tile_x:bool
- tile_y:bool
- stretch_value:f32
Description
Controls how the image is altered to fit within the layout and how the layout algorithm determines the space in the layout for the image
Associated Functions
For function details and documentation, click on the function link.
Label
Label
Description
Marker struct for labels
Associated Functions
For function details and documentation, click on the function link.
Text
Text
- String
Description
The top-level UI text component.
Adding [
Text] to an entity will pull in required components for setting up a UI text node.The string in this component is the first 'text span' in a hierarchy of text spans that are collected into a [
ComputedTextBlock]. SeeTextSpanfor the component used by children of entities with [Text].Note that
Transformon this entity is managed automatically by the UI layout system.# use bevy_asset::Handle; # use bevy_color::Color; # use bevy_color::palettes::basic::BLUE; # use bevy_ecs::world::World; # use bevy_text::{Font, JustifyText, TextLayout, TextFont, TextColor, TextSpan}; # use bevy_ui::prelude::Text; # # let font_handle: Handle<Font> = Default::default(); # let mut world = World::default(); # // Basic usage. world.spawn(Text::new("hello world!")); // With non-default style. world.spawn(( Text::new("hello world!"), TextFont { font: font_handle.clone().into(), font_size: 60.0, ..Default::default() }, TextColor(BLUE.into()), )); // With text justification. world.spawn(( Text::new("hello world\nand bevy!"), TextLayout::new_with_justify(JustifyText::Center) )); // With spans world.spawn(Text::new("hello ")).with_children(|parent| { parent.spawn(TextSpan::new("world")); parent.spawn((TextSpan::new("!"), TextColor(BLUE.into()))); });
Associated Functions
For function details and documentation, click on the function link.
TextNodeFlags
TextNodeFlags
- needs_measure_fn:bool
- needs_recompute:bool
Description
UI text system flags.
Used internally by [
measure_text_system] and [text_system] to schedule text for processing.
Associated Functions
For function details and documentation, click on the function link.
AppLifecycle
Idle
Running
WillSuspend
Suspended
WillResume
Description
Application lifetime events
Associated Functions
For function details and documentation, click on the function link.
CursorEntered
CursorEntered
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever the user's cursor enters a window.
Associated Functions
For function details and documentation, click on the function link.
CursorLeft
CursorLeft
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever the user's cursor leaves a window.
Associated Functions
For function details and documentation, click on the function link.
CursorMoved
CursorMoved
- window:bevy_ecs::entity::Entity
- position:glam::Vec2
- delta:core::option::Optionglam::Vec2
Description
An event reporting that the mouse cursor has moved inside a window.
The event is sent only if the cursor is over one of the application's windows. It is the translated version of
WindowEvent::CursorMovedfrom thewinitcrate with the addition ofdelta.Not to be confused with the
MouseMotionevent frombevy_input.Because the range of data is limited by the window area and it may have been transformed by the OS to implement certain effects like acceleration, you should not use it for non-cursor-like behavior such as 3D camera control. Please see
MouseMotioninstead.
Associated Functions
For function details and documentation, click on the function link.
FileDragAndDrop
DroppedFile
- window:bevy_ecs::entity::Entity
- path_buf:PathBuf
HoveredFile
- window:bevy_ecs::entity::Entity
- path_buf:PathBuf
HoveredFileCanceled
- window:bevy_ecs::entity::Entity
Description
Events related to files being dragged and dropped on a window.
Associated Functions
For function details and documentation, click on the function link.
Ime
Preedit
- window:bevy_ecs::entity::Entity
- value:String
- cursor:core::option::Option<(usize, usize)>
Commit
- window:bevy_ecs::entity::Entity
- value:String
Enabled
- window:bevy_ecs::entity::Entity
Disabled
- window:bevy_ecs::entity::Entity
Description
An Input Method Editor event.
This event is the translated version of the
WindowEvent::Imefrom thewinitcrate.It is only sent if IME was enabled on the window with
Window::ime_enabled.
Associated Functions
For function details and documentation, click on the function link.
RequestRedraw
RequestRedraw
Description
An event that indicates all of the application's windows should be redrawn, even if their control flow is set to
Waitand there have been no window events.
Associated Functions
For function details and documentation, click on the function link.
WindowBackendScaleFactorChanged
WindowBackendScaleFactorChanged
- window:bevy_ecs::entity::Entity
- scale_factor:f64
Description
An event that indicates a window's OS-reported scale factor has changed.
Associated Functions
For function details and documentation, click on the function link.
WindowCloseRequested
WindowCloseRequested
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever the operating systems requests that a window be closed. This will be sent when the close button of the window is pressed.
If the default
WindowPluginis used, these events are handled by closing the correspondingWindow. To disable this behavior, setclose_when_requestedon theWindowPlugintofalse.
Associated Functions
For function details and documentation, click on the function link.
WindowClosed
WindowClosed
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever a window is closed. This will be sent when the window entity loses its
Windowcomponent or is despawned.
Associated Functions
For function details and documentation, click on the function link.
WindowClosing
WindowClosing
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever a window is closing. This will be sent when after a [
WindowCloseRequested] event is received and the window is in the process of closing.
Associated Functions
For function details and documentation, click on the function link.
WindowCreated
WindowCreated
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever a new window is created.
To create a new window, spawn an entity with a [
crate::Window] on it.
Associated Functions
For function details and documentation, click on the function link.
WindowDestroyed
WindowDestroyed
- window:bevy_ecs::entity::Entity
Description
An event that is sent whenever a window is destroyed by the underlying window system.
Note that if your application only has a single window, this event may be your last chance to persist state before the application terminates.
Associated Functions
For function details and documentation, click on the function link.
WindowEvent
AppLifecycle
- bevy_window::event::AppLifecycle
CursorEntered
- bevy_window::event::CursorEntered
CursorLeft
- bevy_window::event::CursorLeft
CursorMoved
- bevy_window::event::CursorMoved
FileDragAndDrop
- bevy_window::event::FileDragAndDrop
Ime
- bevy_window::event::Ime
RequestRedraw
- bevy_window::event::RequestRedraw
WindowBackendScaleFactorChanged
- bevy_window::event::WindowBackendScaleFactorChanged
WindowCloseRequested
- bevy_window::event::WindowCloseRequested
WindowCreated
- bevy_window::event::WindowCreated
WindowDestroyed
- bevy_window::event::WindowDestroyed
WindowFocused
- bevy_window::event::WindowFocused
WindowMoved
- bevy_window::event::WindowMoved
WindowOccluded
- bevy_window::event::WindowOccluded
WindowResized
- bevy_window::event::WindowResized
WindowScaleFactorChanged
- bevy_window::event::WindowScaleFactorChanged
WindowThemeChanged
- bevy_window::event::WindowThemeChanged
MouseButtonInput
- bevy_input::mouse::MouseButtonInput
MouseMotion
- bevy_input::mouse::MouseMotion
MouseWheel
- bevy_input::mouse::MouseWheel
PinchGesture
- bevy_input::gestures::PinchGesture
RotationGesture
- bevy_input::gestures::RotationGesture
DoubleTapGesture
- bevy_input::gestures::DoubleTapGesture
PanGesture
- bevy_input::gestures::PanGesture
TouchInput
- bevy_input::touch::TouchInput
KeyboardInput
- bevy_input::keyboard::KeyboardInput
KeyboardFocusLost
- bevy_input::keyboard::KeyboardFocusLost
Description
Wraps all
bevy_windowandbevy_inputevents in a common enum.Read these events with
EventReader<WindowEvent>if you need to access window events in the order they were received from the operating system. Otherwise, the event types are individually readable withEventReader<E>(e.g.EventReader<KeyboardInput>).
Associated Functions
For function details and documentation, click on the function link.
WindowFocused
WindowFocused
- window:bevy_ecs::entity::Entity
- focused:bool
Description
An event that indicates a window has received or lost focus.
Associated Functions
For function details and documentation, click on the function link.
WindowMoved
WindowMoved
- window:bevy_ecs::entity::Entity
- position:glam::IVec2
Description
An event that is sent when a window is repositioned in physical pixels.
Associated Functions
For function details and documentation, click on the function link.
WindowOccluded
WindowOccluded
- window:bevy_ecs::entity::Entity
- occluded:bool
Description
The window has been occluded (completely hidden from view).
This is different to window visibility as it depends on whether the window is closed, minimized, set invisible, or fully occluded by another window.
It is the translated version of
WindowEvent::Occludedfrom thewinitcrate.
Associated Functions
For function details and documentation, click on the function link.
WindowResized
WindowResized
- window:bevy_ecs::entity::Entity
- width:f32
- height:f32
Description
A window event that is sent whenever a window's logical size has changed.
Associated Functions
For function details and documentation, click on the function link.
WindowScaleFactorChanged
WindowScaleFactorChanged
- window:bevy_ecs::entity::Entity
- scale_factor:f64
Description
An event that indicates a window's scale factor has changed.
Associated Functions
For function details and documentation, click on the function link.
WindowThemeChanged
WindowThemeChanged
- window:bevy_ecs::entity::Entity
- theme:bevy_window::window::WindowTheme
Description
An event sent when the system theme changes for a window.
This event is only sent when the window is relying on the system theme to control its appearance. i.e. It is only sent when
Window::window_themeisNoneand the system theme changes.
Associated Functions
For function details and documentation, click on the function link.
Monitor
Monitor
- name:core::option::Optionalloc::string::String
- physical_height:u32
- physical_width:u32
- physical_position:glam::IVec2
- refresh_rate_millihertz:core::option::Option
- scale_factor:f64
- video_modes:alloc::vec::Vec<bevy_window::monitor::VideoMode>
Description
Represents an available monitor as reported by the user's operating system, which can be used to query information about the display, such as its size, position, and video modes.
Each monitor corresponds to an entity and can be used to position a monitor using [
crate::window::MonitorSelection::Entity].Warning
This component is synchronized with
winitthroughbevy_winit, but is effectively read-only aswinitdoes not support changing monitor properties.
Associated Functions
For function details and documentation, click on the function link.
VideoMode
VideoMode
- physical_size:glam::UVec2
- bit_depth:u16
- refresh_rate_millihertz:u32
Description
Represents a video mode that a monitor supports
Associated Functions
For function details and documentation, click on the function link.
SystemCursorIcon
Default
ContextMenu
Help
Pointer
Progress
Wait
Cell
Crosshair
Text
VerticalText
Alias
Copy
Move
NoDrop
NotAllowed
Grab
Grabbing
EResize
NResize
NeResize
NwResize
SResize
SeResize
SwResize
WResize
EwResize
NsResize
NeswResize
NwseResize
ColResize
RowResize
AllScroll
ZoomIn
ZoomOut
Description
The icon to display for a window.
Examples of all of these cursors can be found here. This
enumis simply a copy of a similarenumfound inwinit.winit, in turn, is based upon the CSS3 UI spec.See the
window_settingsexample for usage.
Associated Functions
For function details and documentation, click on the function link.
CompositeAlphaMode
Auto
Opaque
PreMultiplied
PostMultiplied
Inherit
Description
Specifies how the alpha channel of the textures should be handled during compositing, for a [
Window].
Associated Functions
For function details and documentation, click on the function link.
CursorGrabMode
None
Confined
Locked
Description
Defines if and how the cursor is grabbed by a [
Window].Platform-specific
Windowsdoesn't support [CursorGrabMode::Locked]macOSdoesn't support [CursorGrabMode::Confined]iOS/Androiddon't have cursors.Since
WindowsandmacOShave different [CursorGrabMode] support, we first try to set the grab mode that was asked for. If it doesn't work then use the alternate grab mode.
Associated Functions
For function details and documentation, click on the function link.
CursorOptions
CursorOptions
- visible:bool
- grab_mode:bevy_window::window::CursorGrabMode
- hit_test:bool
Description
Cursor data for a [
Window].
Associated Functions
For function details and documentation, click on the function link.
EnabledButtons
EnabledButtons
- minimize:bool
- maximize:bool
- close:bool
Description
Specifies which [
Window] control buttons should be enabled.Platform-specific
iOS,Android, and theWebdo not have window control buttons.On some
Linuxenvironments these values have no effect.
Associated Functions
For function details and documentation, click on the function link.
InternalWindowState
InternalWindowState
- minimize_request:core::option::Option
- maximize_request:core::option::Option
- drag_move_request:bool
- drag_resize_request:core::option::Option<bevy_math::compass::CompassOctant>
- physical_cursor_position:core::option::Optionglam::DVec2
Description
Stores internal [
Window] state that isn't directly accessible.
Associated Functions
For function details and documentation, click on the function link.
MonitorSelection
Current
Primary
Index
- usize
Entity
- bevy_ecs::entity::Entity
Description
References a screen monitor.
Used when centering a [
Window] on a monitor.
Associated Functions
For function details and documentation, click on the function link.
PresentMode
AutoVsync
AutoNoVsync
Fifo
FifoRelaxed
Immediate
Mailbox
Description
Presentation mode for a [
Window].The presentation mode specifies when a frame is presented to the window. The
Fifooption corresponds to a traditionalVSync, where the framerate is capped by the display refresh rate. BothImmediateandMailboxare low-latency and are not capped by the refresh rate, but may not be available on all platforms. Tearing may be observed withImmediatemode, but will not be observed withMailboxorFifo.
AutoVsyncorAutoNoVsyncwill gracefully fallback toFifowhen unavailable.
ImmediateorMailboxwill panic if not supported by the platform.
Associated Functions
For function details and documentation, click on the function link.
PrimaryWindow
PrimaryWindow
Description
Marker [
Component] for the window considered the primary window.Currently this is assumed to only exist on 1 entity at a time.
WindowPluginwill spawn a [Window] entity with this component ifprimary_windowisSome.
Associated Functions
For function details and documentation, click on the function link.
VideoModeSelection
Current
Specific
- bevy_window::monitor::VideoMode
Description
References an exclusive fullscreen video mode.
Used when setting [
WindowMode::Fullscreen] on a window.
Associated Functions
For function details and documentation, click on the function link.
Window
Window
- cursor_options:bevy_window::window::CursorOptions
- present_mode:bevy_window::window::PresentMode
- mode:bevy_window::window::WindowMode
- position:bevy_window::window::WindowPosition
- resolution:bevy_window::window::WindowResolution
- title:String
- name:core::option::Optionalloc::string::String
- composite_alpha_mode:bevy_window::window::CompositeAlphaMode
- resize_constraints:bevy_window::window::WindowResizeConstraints
- resizable:bool
- enabled_buttons:bevy_window::window::EnabledButtons
- decorations:bool
- transparent:bool
- focused:bool
- window_level:bevy_window::window::WindowLevel
- canvas:core::option::Optionalloc::string::String
- fit_canvas_to_parent:bool
- prevent_default_event_handling:bool
- internal:bevy_window::window::InternalWindowState
- ime_enabled:bool
- ime_position:glam::Vec2
- window_theme:core::option::Option<bevy_window::window::WindowTheme>
- visible:bool
- skip_taskbar:bool
- clip_children:bool
- desired_maximum_frame_latency:core::option::Optioncore::num::NonZeroU32
- recognize_pinch_gesture:bool
- recognize_rotation_gesture:bool
- recognize_doubletap_gesture:bool
- recognize_pan_gesture:core::option::Option<(u8, u8)>
- movable_by_window_background:bool
- fullsize_content_view:bool
- has_shadow:bool
- titlebar_shown:bool
- titlebar_transparent:bool
- titlebar_show_title:bool
- titlebar_show_buttons:bool
- prefers_home_indicator_hidden:bool
- prefers_status_bar_hidden:bool
Description
The defining [
Component] for window entities, storing information about how it should appear and behave.Each window corresponds to an entity, and is uniquely identified by the value of their [
Entity]. When the [Window] component is added to an entity, a new window will be opened. When it is removed or the entity is despawned, the window will close.The primary window entity (and the corresponding window) is spawned by default by
WindowPluginand is marked with the [PrimaryWindow] component.This component is synchronized with
winitthroughbevy_winit: it will reflect the current state of the window and can be modified to change this state.Example
Because this component is synchronized with
winit, it can be used to perform OS-integrated windowing operations. For example, here's a simple system to change the window mode:# use bevy_ecs::query::With; # use bevy_ecs::system::Query; # use bevy_window::{WindowMode, PrimaryWindow, Window, MonitorSelection, VideoModeSelection}; fn change_window_mode(mut windows: Query<&mut Window, With<PrimaryWindow>>) { // Query returns one window typically. for mut window in windows.iter_mut() { window.mode = WindowMode::Fullscreen(MonitorSelection::Current, VideoModeSelection::Current); } }
Associated Functions
For function details and documentation, click on the function link.
WindowLevel
AlwaysOnBottom
Normal
AlwaysOnTop
Description
Specifies where a [
Window] should appear relative to other overlapping windows (on top or under) .Levels are groups of windows with respect to their z-position.
The relative ordering between windows in different window levels is fixed. The z-order of windows within the same window level may change dynamically on user interaction.
Platform-specific
- iOS / Android / Web / Wayland: Unsupported.
Associated Functions
For function details and documentation, click on the function link.
WindowMode
Windowed
BorderlessFullscreen
- bevy_window::window::MonitorSelection
Fullscreen
- bevy_window::window::MonitorSelection
- bevy_window::window::VideoModeSelection
Description
Defines the way a [
Window] is displayed.
Associated Functions
For function details and documentation, click on the function link.
WindowPosition
Automatic
Centered
- bevy_window::window::MonitorSelection
At
- glam::IVec2
Description
Defines where a [
Window] should be placed on the screen.
Associated Functions
For function details and documentation, click on the function link.
WindowRef
Primary
Entity
- bevy_ecs::entity::Entity
Description
Reference to a [
Window], whether it be a direct link to a specific entity or a more vague defaulting choice.
Associated Functions
For function details and documentation, click on the function link.
WindowResizeConstraints
WindowResizeConstraints
- min_width:f32
- min_height:f32
- max_width:f32
- max_height:f32
Description
The size limits on a [
Window].These values are measured in logical pixels (see [
WindowResolution]), so the user's scale factor does affect the size limits on the window.Please note that if the window is resizable, then when the window is maximized it may have a size outside of these limits. The functionality required to disable maximizing is not yet exposed by winit.
Associated Functions
For function details and documentation, click on the function link.
WindowResolution
WindowResolution
- physical_width:u32
- physical_height:u32
- scale_factor_override:core::option::Option
- scale_factor:f32
Description
Controls the size of a [
Window]Physical, logical and requested sizes
There are three sizes associated with a window:
- the physical size, which represents the actual height and width in physical pixels the window occupies on the monitor,
- the logical size, which represents the size that should be used to scale elements inside the window, measured in logical pixels,
- the requested size, measured in logical pixels, which is the value submitted to the API when creating the window, or requesting that it be resized.
Scale factor
The reason logical size and physical size are separated and can be different is to account for the cases where:
- several monitors have different pixel densities,
- the user has set up a pixel density preference in its operating system,
- the Bevy
Apphas specified a specific scale factor between both.The factor between physical size and logical size can be retrieved with [
WindowResolution::scale_factor].For the first two cases, a scale factor is set automatically by the operating system through the window backend. You can get it with [
WindowResolution::base_scale_factor].For the third case, you can override this automatic scale factor with [
WindowResolution::set_scale_factor_override].Requested and obtained sizes
The logical size should be equal to the requested size after creating/resizing, when possible. The reason the requested size and logical size might be different is because the corresponding physical size might exceed limits (either the size limits of the monitor, or limits defined in [
WindowResizeConstraints]).Note: The requested size is not kept in memory, for example requesting a size too big for the screen, making the logical size different from the requested size, and then setting a scale factor that makes the previous requested size within the limits of the screen will not get back that previous requested size.
Associated Functions
For function details and documentation, click on the function link.
WindowTheme
Light
Dark
Description
The [
Window] theme variant to use.
Associated Functions
For function details and documentation, click on the function link.
CursorIcon
Custom
- bevy_winit::custom_cursor::CustomCursor
System
- bevy_window::system_cursor::SystemCursorIcon
Description
Insert into a window entity to set the cursor for that window.
Associated Functions
For function details and documentation, click on the function link.
CustomCursor
Image
- bevy_winit::custom_cursor::CustomCursorImage
Description
Custom cursor image data.
Associated Functions
For function details and documentation, click on the function link.
CustomCursorImage
CustomCursorImage
- handle:bevy_asset::handle::Handle<bevy_image::image::Image>
- texture_atlas:core::option::Option<bevy_image::texture_atlas::TextureAtlas>
- flip_x:bool
- flip_y:bool
- rect:core::option::Option<bevy_math::rects::urect::URect>
- hotspot:(u16, u16)
Description
A custom cursor created from an image.
Associated Functions
For function details and documentation, click on the function link.
bool
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
char
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
NonZeroI16
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
NonZeroU16
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
NonZeroU32
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
f32
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
f64
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
i128
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
i16
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
i32
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
i64
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
i8
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
isize
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
NodeIndex
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
u128
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
u16
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
u32
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
u64
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
u8
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
usize
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Cow
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<String>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<TimedAnimationEvent>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<AnimationTransition>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<Entity>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<URect>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<ScriptQueryResult>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<ReflectReference>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<FunctionArgInfo>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<FunctionInfo>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<Cascade>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<ReflectSystem>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<PositionedGlyph>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<GridTrack>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<RepeatedGridTrack>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<ShadowStyle>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<VideoMode>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<f32>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<NodeIndex>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<u16>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<u32>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<u64>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Handle<()>
Strong
- bevy_platform::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<()>
Description
A handle to a specific [
Asset] of typeA. Handles act as abstract "references" to assets, whose data are stored in theAssets<A>resource, avoiding the need to store multiple copies of the same data.If a [
Handle] is [Handle::Strong], the [Asset] will be kept alive until the [Handle] is dropped. If a [Handle] is [Handle::Weak], it does not necessarily reference a live [Asset], nor will it keep assets alive.Modifying a handle will change which existing asset is referenced, but modifying the asset (by mutating the
Assetsresource) will change the asset for all handles referencing it.[
Handle] can be cloned. If a [Handle::Strong] is cloned, the referenced [Asset] will not be freed until all instances of the [Handle] are dropped.[
Handle::Strong], via [StrongHandle] also provides access to useful [Asset] metadata, such as the [AssetPath] (if it exists).
Associated Functions
For function details and documentation, click on the function link.
Handle<AnimationClip>
Strong
- bevy_platform::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_animation::AnimationClip>
Description
A handle to a specific [
Asset] of typeA. Handles act as abstract "references" to assets, whose data are stored in theAssets<A>resource, avoiding the need to store multiple copies of the same data.If a [
Handle] is [Handle::Strong], the [Asset] will be kept alive until the [Handle] is dropped. If a [Handle] is [Handle::Weak], it does not necessarily reference a live [Asset], nor will it keep assets alive.Modifying a handle will change which existing asset is referenced, but modifying the asset (by mutating the
Assetsresource) will change the asset for all handles referencing it.[
Handle] can be cloned. If a [Handle::Strong] is cloned, the referenced [Asset] will not be freed until all instances of the [Handle] are dropped.[
Handle::Strong], via [StrongHandle] also provides access to useful [Asset] metadata, such as the [AssetPath] (if it exists).
Associated Functions
For function details and documentation, click on the function link.
Handle<AnimationGraph>
Strong
- bevy_platform::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_animation::graph::AnimationGraph>
Description
A handle to a specific [
Asset] of typeA. Handles act as abstract "references" to assets, whose data are stored in theAssets<A>resource, avoiding the need to store multiple copies of the same data.If a [
Handle] is [Handle::Strong], the [Asset] will be kept alive until the [Handle] is dropped. If a [Handle] is [Handle::Weak], it does not necessarily reference a live [Asset], nor will it keep assets alive.Modifying a handle will change which existing asset is referenced, but modifying the asset (by mutating the
Assetsresource) will change the asset for all handles referencing it.[
Handle] can be cloned. If a [Handle::Strong] is cloned, the referenced [Asset] will not be freed until all instances of the [Handle] are dropped.[
Handle::Strong], via [StrongHandle] also provides access to useful [Asset] metadata, such as the [AssetPath] (if it exists).
Associated Functions
For function details and documentation, click on the function link.
Handle<Image>
Strong
- bevy_platform::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_image::image::Image>
Description
A handle to a specific [
Asset] of typeA. Handles act as abstract "references" to assets, whose data are stored in theAssets<A>resource, avoiding the need to store multiple copies of the same data.If a [
Handle] is [Handle::Strong], the [Asset] will be kept alive until the [Handle] is dropped. If a [Handle] is [Handle::Weak], it does not necessarily reference a live [Asset], nor will it keep assets alive.Modifying a handle will change which existing asset is referenced, but modifying the asset (by mutating the
Assetsresource) will change the asset for all handles referencing it.[
Handle] can be cloned. If a [Handle::Strong] is cloned, the referenced [Asset] will not be freed until all instances of the [Handle] are dropped.[
Handle::Strong], via [StrongHandle] also provides access to useful [Asset] metadata, such as the [AssetPath] (if it exists).
Associated Functions
For function details and documentation, click on the function link.
Handle<TextureAtlasLayout>
Strong
- bevy_platform::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_image::texture_atlas::TextureAtlasLayout>
Description
A handle to a specific [
Asset] of typeA. Handles act as abstract "references" to assets, whose data are stored in theAssets<A>resource, avoiding the need to store multiple copies of the same data.If a [
Handle] is [Handle::Strong], the [Asset] will be kept alive until the [Handle] is dropped. If a [Handle] is [Handle::Weak], it does not necessarily reference a live [Asset], nor will it keep assets alive.Modifying a handle will change which existing asset is referenced, but modifying the asset (by mutating the
Assetsresource) will change the asset for all handles referencing it.[
Handle] can be cloned. If a [Handle::Strong] is cloned, the referenced [Asset] will not be freed until all instances of the [Handle] are dropped.[
Handle::Strong], via [StrongHandle] also provides access to useful [Asset] metadata, such as the [AssetPath] (if it exists).
Associated Functions
For function details and documentation, click on the function link.
Handle<Mesh>
Strong
- bevy_platform::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_mesh::mesh::Mesh>
Description
A handle to a specific [
Asset] of typeA. Handles act as abstract "references" to assets, whose data are stored in theAssets<A>resource, avoiding the need to store multiple copies of the same data.If a [
Handle] is [Handle::Strong], the [Asset] will be kept alive until the [Handle] is dropped. If a [Handle] is [Handle::Weak], it does not necessarily reference a live [Asset], nor will it keep assets alive.Modifying a handle will change which existing asset is referenced, but modifying the asset (by mutating the
Assetsresource) will change the asset for all handles referencing it.[
Handle] can be cloned. If a [Handle::Strong] is cloned, the referenced [Asset] will not be freed until all instances of the [Handle] are dropped.[
Handle::Strong], via [StrongHandle] also provides access to useful [Asset] metadata, such as the [AssetPath] (if it exists).
Associated Functions
For function details and documentation, click on the function link.
Handle<StandardMaterial>
Strong
- bevy_platform::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_pbr::pbr_material::StandardMaterial>
Description
A handle to a specific [
Asset] of typeA. Handles act as abstract "references" to assets, whose data are stored in theAssets<A>resource, avoiding the need to store multiple copies of the same data.If a [
Handle] is [Handle::Strong], the [Asset] will be kept alive until the [Handle] is dropped. If a [Handle] is [Handle::Weak], it does not necessarily reference a live [Asset], nor will it keep assets alive.Modifying a handle will change which existing asset is referenced, but modifying the asset (by mutating the
Assetsresource) will change the asset for all handles referencing it.[
Handle] can be cloned. If a [Handle::Strong] is cloned, the referenced [Asset] will not be freed until all instances of the [Handle] are dropped.[
Handle::Strong], via [StrongHandle] also provides access to useful [Asset] metadata, such as the [AssetPath] (if it exists).
Associated Functions
For function details and documentation, click on the function link.
Handle<ShaderStorageBuffer>
Strong
- bevy_platform::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_render::storage::ShaderStorageBuffer>
Description
A handle to a specific [
Asset] of typeA. Handles act as abstract "references" to assets, whose data are stored in theAssets<A>resource, avoiding the need to store multiple copies of the same data.If a [
Handle] is [Handle::Strong], the [Asset] will be kept alive until the [Handle] is dropped. If a [Handle] is [Handle::Weak], it does not necessarily reference a live [Asset], nor will it keep assets alive.Modifying a handle will change which existing asset is referenced, but modifying the asset (by mutating the
Assetsresource) will change the asset for all handles referencing it.[
Handle] can be cloned. If a [Handle::Strong] is cloned, the referenced [Asset] will not be freed until all instances of the [Handle] are dropped.[
Handle::Strong], via [StrongHandle] also provides access to useful [Asset] metadata, such as the [AssetPath] (if it exists).
Associated Functions
For function details and documentation, click on the function link.
Handle<ColorMaterial>
Strong
- bevy_platform::sync::Arc<bevy_asset::handle::StrongHandle>
Weak
- bevy_asset::id::AssetId<bevy_sprite::mesh2d::color_material::ColorMaterial>
Description
A handle to a specific [
Asset] of typeA. Handles act as abstract "references" to assets, whose data are stored in theAssets<A>resource, avoiding the need to store multiple copies of the same data.If a [
Handle] is [Handle::Strong], the [Asset] will be kept alive until the [Handle] is dropped. If a [Handle] is [Handle::Weak], it does not necessarily reference a live [Asset], nor will it keep assets alive.Modifying a handle will change which existing asset is referenced, but modifying the asset (by mutating the
Assetsresource) will change the asset for all handles referencing it.[
Handle] can be cloned. If a [Handle::Strong] is cloned, the referenced [Asset] will not be freed until all instances of the [Handle] are dropped.[
Handle::Strong], via [StrongHandle] also provides access to useful [Asset] metadata, such as the [AssetPath] (if it exists).
Associated Functions
For function details and documentation, click on the function link.
AssetId<()>
Index
- index:bevy_asset::assets::AssetIndex
Uuid
- uuid:uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset]. This is cheap to [Copy]/[Clone] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle.For an "untyped" / "generic-less" id, see [
UntypedAssetId].
Associated Functions
For function details and documentation, click on the function link.
AssetId<AnimationClip>
Index
- index:bevy_asset::assets::AssetIndex
Uuid
- uuid:uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset]. This is cheap to [Copy]/[Clone] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle.For an "untyped" / "generic-less" id, see [
UntypedAssetId].
Associated Functions
For function details and documentation, click on the function link.
AssetId<AnimationGraph>
Index
- index:bevy_asset::assets::AssetIndex
Uuid
- uuid:uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset]. This is cheap to [Copy]/[Clone] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle.For an "untyped" / "generic-less" id, see [
UntypedAssetId].
Associated Functions
For function details and documentation, click on the function link.
AssetId<Image>
Index
- index:bevy_asset::assets::AssetIndex
Uuid
- uuid:uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset]. This is cheap to [Copy]/[Clone] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle.For an "untyped" / "generic-less" id, see [
UntypedAssetId].
Associated Functions
For function details and documentation, click on the function link.
AssetId<TextureAtlasLayout>
Index
- index:bevy_asset::assets::AssetIndex
Uuid
- uuid:uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset]. This is cheap to [Copy]/[Clone] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle.For an "untyped" / "generic-less" id, see [
UntypedAssetId].
Associated Functions
For function details and documentation, click on the function link.
AssetId<Mesh>
Index
- index:bevy_asset::assets::AssetIndex
Uuid
- uuid:uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset]. This is cheap to [Copy]/[Clone] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle.For an "untyped" / "generic-less" id, see [
UntypedAssetId].
Associated Functions
For function details and documentation, click on the function link.
AssetId<ScriptAsset>
Index
- index:bevy_asset::assets::AssetIndex
Uuid
- uuid:uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset]. This is cheap to [Copy]/[Clone] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle.For an "untyped" / "generic-less" id, see [
UntypedAssetId].
Associated Functions
For function details and documentation, click on the function link.
AssetId<StandardMaterial>
Index
- index:bevy_asset::assets::AssetIndex
Uuid
- uuid:uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset]. This is cheap to [Copy]/[Clone] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle.For an "untyped" / "generic-less" id, see [
UntypedAssetId].
Associated Functions
For function details and documentation, click on the function link.
AssetId<ShaderStorageBuffer>
Index
- index:bevy_asset::assets::AssetIndex
Uuid
- uuid:uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset]. This is cheap to [Copy]/[Clone] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle.For an "untyped" / "generic-less" id, see [
UntypedAssetId].
Associated Functions
For function details and documentation, click on the function link.
AssetId<ColorMaterial>
Index
- index:bevy_asset::assets::AssetIndex
Uuid
- uuid:uuid::Uuid
Description
A unique runtime-only identifier for an [
Asset]. This is cheap to [Copy]/[Clone] and is not directly tied to the lifetime of the Asset. This means it can point to an [Asset] that no longer exists.For an identifier tied to the lifetime of an asset, see
Handle.For an "untyped" / "generic-less" id, see [
UntypedAssetId].
Associated Functions
For function details and documentation, click on the function link.
Axis<GamepadInput>
Axis
- axis_data:bevy_platform::collections::HashMap<bevy_input::gamepad::GamepadInput, f32, bevy_platform::hash::FixedHasher>
Description
Stores the position data of the input devices of type
T.The values are stored as
f32s, using [Axis::set]. Use [Axis::get] to retrieve the value clamped between [Axis::MIN] and [Axis::MAX] inclusive, or unclamped using [Axis::get_unclamped].
Associated Functions
For function details and documentation, click on the function link.
ButtonInput<GamepadButton>
ButtonInput
- pressed:bevy_platform::collections::HashSet<bevy_input::gamepad::GamepadButton, bevy_platform::hash::FixedHasher>
- just_pressed:bevy_platform::collections::HashSet<bevy_input::gamepad::GamepadButton, bevy_platform::hash::FixedHasher>
- just_released:bevy_platform::collections::HashSet<bevy_input::gamepad::GamepadButton, bevy_platform::hash::FixedHasher>
Description
A "press-able" input of type
T.Usage
This type can be used as a resource to keep the current state of an input, by reacting to events from the input. For a given input value:
- [
ButtonInput::pressed] will returntruebetween a press and a release event.- [
ButtonInput::just_pressed] will returntruefor one frame after a press event.- [
ButtonInput::just_released] will returntruefor one frame after a release event.Multiple systems
In case multiple systems are checking for [
ButtonInput::just_pressed] or [ButtonInput::just_released] but only one should react, for example when modifying a [Resource], you should consider clearing the input state, either by:
- Using [
ButtonInput::clear_just_pressed] or [ButtonInput::clear_just_released] instead.- Calling [
ButtonInput::clear] or [ButtonInput::reset] immediately after the state change.Performance
For all operations, the following conventions are used:
- n is the number of stored inputs.
- m is the number of input arguments passed to the method.
- *-suffix denotes an amortized cost.
- ~-suffix denotes an expected cost.
See Rust's std::collections doc on performance for more details on the conventions used here.
[ ButtonInput] operationsComputational complexity [ ButtonInput::any_just_pressed]O(m)~ [ ButtonInput::any_just_released]O(m)~ [ ButtonInput::any_pressed]O(m)~ [ ButtonInput::get_just_pressed]O(n) [ ButtonInput::get_just_released]O(n) [ ButtonInput::get_pressed]O(n) [ ButtonInput::just_pressed]O(1)~ [ ButtonInput::just_released]O(1)~ [ ButtonInput::pressed]O(1)~ [ ButtonInput::press]O(1)~* [ ButtonInput::release]O(1)~* [ ButtonInput::release_all]O(n)~* [ ButtonInput::clear_just_pressed]O(1)~ [ ButtonInput::clear_just_released]O(1)~ [ ButtonInput::reset_all]O(n) [ ButtonInput::clear]O(n) Window focus
ButtonInput<KeyCode>is tied to window focus. For example, if the user holds a button while the window loses focus, [ButtonInput::just_released] will be triggered. Similarly if the window regains focus, [ButtonInput::just_pressed] will be triggered.
ButtonInput<GamepadButton>is independent of window focus.Examples
Reading and checking against the current set of pressed buttons:
# use bevy_app::{App, NoopPluginGroup as DefaultPlugins, Update}; # use bevy_ecs::{prelude::{IntoScheduleConfigs, Res, Resource, resource_changed}, schedule::Condition}; # use bevy_input::{ButtonInput, prelude::{KeyCode, MouseButton}}; fn main() { App::new() .add_plugins(DefaultPlugins) .add_systems( Update, print_mouse.run_if(resource_changed::<ButtonInput<MouseButton>>), ) .add_systems( Update, print_keyboard.run_if(resource_changed::<ButtonInput<KeyCode>>), ) .run(); } fn print_mouse(mouse: Res<ButtonInput<MouseButton>>) { println!("Mouse: {:?}", mouse.get_pressed().collect::<Vec<_>>()); } fn print_keyboard(keyboard: Res<ButtonInput<KeyCode>>) { if keyboard.any_pressed([KeyCode::ControlLeft, KeyCode::ControlRight]) && keyboard.any_pressed([KeyCode::AltLeft, KeyCode::AltRight]) && keyboard.any_pressed([KeyCode::ShiftLeft, KeyCode::ShiftRight]) && keyboard.any_pressed([KeyCode::SuperLeft, KeyCode::SuperRight]) && keyboard.pressed(KeyCode::KeyL) { println!("On Windows this opens LinkedIn."); } else { println!("keyboard: {:?}", keyboard.get_pressed().collect::<Vec<_>>()); } }Note
When adding this resource for a new input type, you should:
- Call the [
ButtonInput::press] method for each press event.- Call the [
ButtonInput::release] method for each release event.- Call the [
ButtonInput::clear] method at each frame start, before processing events.Note: Calling
clearfrom aResMutwill trigger change detection. It may be preferable to useDetectChangesMut::bypass_change_detectionto avoid causing the resource to always be marked as changed.
Associated Functions
For function details and documentation, click on the function link.
MeshMaterial3d<StandardMaterial>
MeshMaterial3d
- bevy_asset::handle::Handle<bevy_pbr::pbr_material::StandardMaterial>
Description
A material used for rendering a
Mesh3d.See [
Material] for general information about 3D materials and how to implement your own materials.Example
# use bevy_pbr::{Material, MeshMaterial3d, StandardMaterial}; # use bevy_ecs::prelude::*; # use bevy_render::mesh::{Mesh, Mesh3d}; # use bevy_color::palettes::basic::RED; # use bevy_asset::Assets; # use bevy_math::primitives::Capsule3d; # // Spawn an entity with a mesh using `StandardMaterial`. fn setup( mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<StandardMaterial>>, ) { commands.spawn(( Mesh3d(meshes.add(Capsule3d::default())), MeshMaterial3d(materials.add(StandardMaterial { base_color: RED.into(), ..Default::default() })), )); }
Associated Functions
For function details and documentation, click on the function link.
Arc
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
MeshMaterial2d<ColorMaterial>
MeshMaterial2d
- bevy_asset::handle::Handle<bevy_sprite::mesh2d::color_material::ColorMaterial>
Description
A material used for rendering a [
Mesh2d].See [
Material2d] for general information about 2D materials and how to implement your own materials.Example
# use bevy_sprite::{ColorMaterial, MeshMaterial2d}; # use bevy_ecs::prelude::*; # use bevy_render::mesh::{Mesh, Mesh2d}; # use bevy_color::palettes::basic::RED; # use bevy_asset::Assets; # use bevy_math::primitives::Circle; # // Spawn an entity with a mesh using `ColorMaterial`. fn setup( mut commands: Commands, mut meshes: ResMut<Assets<Mesh>>, mut materials: ResMut<Assets<ColorMaterial>>, ) { commands.spawn(( Mesh2d(meshes.add(Circle::new(50.0))), MeshMaterial2d(materials.add(ColorMaterial::from_color(RED))), )); }
Associated Functions
For function details and documentation, click on the function link.
Time<()>
Time
- context:()
- wrap_period:core::time::Duration
- delta:core::time::Duration
- delta_secs:f32
- delta_secs_f64:f64
- elapsed:core::time::Duration
- elapsed_secs:f32
- elapsed_secs_f64:f64
- elapsed_wrapped:core::time::Duration
- elapsed_secs_wrapped:f32
- elapsed_secs_wrapped_f64:f64
Description
A generic clock resource that tracks how much it has advanced since its previous update and since its creation.
Multiple instances of this resource are inserted automatically by
TimePlugin:
Time<Real>tracks real wall-clock time elapsed.Time<Virtual>tracks virtual game time that may be paused or scaled.Time<Fixed>tracks fixed timesteps based on virtual time.- [
Time] is a generic clock that corresponds to "current" or "default" time for systems. It containsTime<Virtual>except inside theFixedMainschedule when it containsTime<Fixed>.The time elapsed since the previous time this clock was advanced is saved as
delta()and the total amount of time the clock has advanced is saved aselapsed(). Both are represented as exact [Duration] values with fixed nanosecond precision. The clock does not support time moving backwards, but it can be updated with [Duration::ZERO] which will setdelta()to zero.These values are also available in seconds as
f32viadelta_secs()andelapsed_secs(), and also in seconds asf64viadelta_secs_f64()andelapsed_secs_f64().Since
elapsed_secs()will grow constantly and isf32, it will exhibit gradual precision loss. For applications that require anf32value but suffer from gradual precision loss there iselapsed_secs_wrapped()available. The same wrapped value is also available as [Duration] andf64for consistency. The wrap period is by default 1 hour, and can be set byset_wrap_period().Accessing clocks
By default, any systems requiring current
delta()orelapsed()should useRes<Time>to access the default time configured for the program. By default, this refers toTime<Virtual>except during theFixedMainschedule when it refers toTime<Fixed>. This ensures your system can be used either inUpdateorFixedUpdateschedule depending on what is needed.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn ambivalent_system(time: Res<Time>) { println!("this how I see time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }If your system needs to react based on real time (wall clock time), like for user interfaces, it should use
Res<Time<Real>>. Thedelta()andelapsed()values will always correspond to real time and will not be affected by pause, time scaling or other tweaks.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn real_time_system(time: Res<Time<Real>>) { println!("this will always be real time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }If your system specifically needs to access fixed timestep clock, even when placed in
Updateschedule, you should useRes<Time<Fixed>>. Thedelta()andelapsed()values will correspond to the latest fixed timestep that has been run.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Fixed>>) { println!("this will always be the last executed fixed timestep: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }Finally, if your system specifically needs to know the current virtual game time, even if placed inside
FixedUpdate, for example to know if the game iswas_paused()or to useeffective_speed(), you can useRes<Time<Virtual>>. However, if the system is placed inFixedUpdate, extra care must be used because your system might be run multiple times with the samedelta()andelapsed()values as the virtual game time has not changed between the iterations.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Virtual>>) { println!("this will be virtual time for this update: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); println!("also the relative speed of the game is now {}", time.effective_speed()); }If you need to change the settings for any of the clocks, for example to
pause()the game, you should useResMut<Time<Virtual>>.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # #[derive(Event)] struct PauseEvent(bool); fn pause_system(mut time: ResMut<Time<Virtual>>, mut events: EventReader<PauseEvent>) { for ev in events.read() { if ev.0 { time.pause(); } else { time.unpause(); } } }Adding custom clocks
New custom clocks can be created by creating your own struct as a context and passing it to
new_with(). These clocks can be inserted as resources as normal and then accessed by systems. You can use theadvance_by()oradvance_to()methods to move the clock forwards based on your own logic.If you want to add methods for your time instance and they require access to both your context and the generic time part, it's probably simplest to add a custom trait for them and implement it for
Time<Custom>.Your context struct will need to implement the [
Default] trait because [Time] structures support reflection. It also makes initialization trivial by being able to callapp.init_resource::<Time<Custom>>().You can also replace the "generic"
Timeclock resource if the "default" time for your game should not be the default virtual time provided. You can get a "generic" snapshot of your clock by callingas_generic()and then overwrite the [Time] resource with it. The default systems added byTimePluginwill overwrite the [Time] clock duringFirstandFixedUpdateschedules.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # use bevy_platform::time::Instant; # #[derive(Debug)] struct Custom { last_external_time: Instant, } impl Default for Custom { fn default() -> Self { Self { last_external_time: Instant::now(), } } } trait CustomTime { fn update_from_external(&mut self, instant: Instant); } impl CustomTime for Time<Custom> { fn update_from_external(&mut self, instant: Instant) { let delta = instant - self.context().last_external_time; self.advance_by(delta); self.context_mut().last_external_time = instant; } }
Associated Functions
For function details and documentation, click on the function link.
Time<Fixed>
Time
- context:bevy_time::fixed::Fixed
- wrap_period:core::time::Duration
- delta:core::time::Duration
- delta_secs:f32
- delta_secs_f64:f64
- elapsed:core::time::Duration
- elapsed_secs:f32
- elapsed_secs_f64:f64
- elapsed_wrapped:core::time::Duration
- elapsed_secs_wrapped:f32
- elapsed_secs_wrapped_f64:f64
Description
A generic clock resource that tracks how much it has advanced since its previous update and since its creation.
Multiple instances of this resource are inserted automatically by
TimePlugin:
Time<Real>tracks real wall-clock time elapsed.Time<Virtual>tracks virtual game time that may be paused or scaled.Time<Fixed>tracks fixed timesteps based on virtual time.- [
Time] is a generic clock that corresponds to "current" or "default" time for systems. It containsTime<Virtual>except inside theFixedMainschedule when it containsTime<Fixed>.The time elapsed since the previous time this clock was advanced is saved as
delta()and the total amount of time the clock has advanced is saved aselapsed(). Both are represented as exact [Duration] values with fixed nanosecond precision. The clock does not support time moving backwards, but it can be updated with [Duration::ZERO] which will setdelta()to zero.These values are also available in seconds as
f32viadelta_secs()andelapsed_secs(), and also in seconds asf64viadelta_secs_f64()andelapsed_secs_f64().Since
elapsed_secs()will grow constantly and isf32, it will exhibit gradual precision loss. For applications that require anf32value but suffer from gradual precision loss there iselapsed_secs_wrapped()available. The same wrapped value is also available as [Duration] andf64for consistency. The wrap period is by default 1 hour, and can be set byset_wrap_period().Accessing clocks
By default, any systems requiring current
delta()orelapsed()should useRes<Time>to access the default time configured for the program. By default, this refers toTime<Virtual>except during theFixedMainschedule when it refers toTime<Fixed>. This ensures your system can be used either inUpdateorFixedUpdateschedule depending on what is needed.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn ambivalent_system(time: Res<Time>) { println!("this how I see time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }If your system needs to react based on real time (wall clock time), like for user interfaces, it should use
Res<Time<Real>>. Thedelta()andelapsed()values will always correspond to real time and will not be affected by pause, time scaling or other tweaks.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn real_time_system(time: Res<Time<Real>>) { println!("this will always be real time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }If your system specifically needs to access fixed timestep clock, even when placed in
Updateschedule, you should useRes<Time<Fixed>>. Thedelta()andelapsed()values will correspond to the latest fixed timestep that has been run.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Fixed>>) { println!("this will always be the last executed fixed timestep: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }Finally, if your system specifically needs to know the current virtual game time, even if placed inside
FixedUpdate, for example to know if the game iswas_paused()or to useeffective_speed(), you can useRes<Time<Virtual>>. However, if the system is placed inFixedUpdate, extra care must be used because your system might be run multiple times with the samedelta()andelapsed()values as the virtual game time has not changed between the iterations.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Virtual>>) { println!("this will be virtual time for this update: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); println!("also the relative speed of the game is now {}", time.effective_speed()); }If you need to change the settings for any of the clocks, for example to
pause()the game, you should useResMut<Time<Virtual>>.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # #[derive(Event)] struct PauseEvent(bool); fn pause_system(mut time: ResMut<Time<Virtual>>, mut events: EventReader<PauseEvent>) { for ev in events.read() { if ev.0 { time.pause(); } else { time.unpause(); } } }Adding custom clocks
New custom clocks can be created by creating your own struct as a context and passing it to
new_with(). These clocks can be inserted as resources as normal and then accessed by systems. You can use theadvance_by()oradvance_to()methods to move the clock forwards based on your own logic.If you want to add methods for your time instance and they require access to both your context and the generic time part, it's probably simplest to add a custom trait for them and implement it for
Time<Custom>.Your context struct will need to implement the [
Default] trait because [Time] structures support reflection. It also makes initialization trivial by being able to callapp.init_resource::<Time<Custom>>().You can also replace the "generic"
Timeclock resource if the "default" time for your game should not be the default virtual time provided. You can get a "generic" snapshot of your clock by callingas_generic()and then overwrite the [Time] resource with it. The default systems added byTimePluginwill overwrite the [Time] clock duringFirstandFixedUpdateschedules.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # use bevy_platform::time::Instant; # #[derive(Debug)] struct Custom { last_external_time: Instant, } impl Default for Custom { fn default() -> Self { Self { last_external_time: Instant::now(), } } } trait CustomTime { fn update_from_external(&mut self, instant: Instant); } impl CustomTime for Time<Custom> { fn update_from_external(&mut self, instant: Instant) { let delta = instant - self.context().last_external_time; self.advance_by(delta); self.context_mut().last_external_time = instant; } }
Associated Functions
For function details and documentation, click on the function link.
Time<Real>
Time
- context:bevy_time::real::Real
- wrap_period:core::time::Duration
- delta:core::time::Duration
- delta_secs:f32
- delta_secs_f64:f64
- elapsed:core::time::Duration
- elapsed_secs:f32
- elapsed_secs_f64:f64
- elapsed_wrapped:core::time::Duration
- elapsed_secs_wrapped:f32
- elapsed_secs_wrapped_f64:f64
Description
A generic clock resource that tracks how much it has advanced since its previous update and since its creation.
Multiple instances of this resource are inserted automatically by
TimePlugin:
Time<Real>tracks real wall-clock time elapsed.Time<Virtual>tracks virtual game time that may be paused or scaled.Time<Fixed>tracks fixed timesteps based on virtual time.- [
Time] is a generic clock that corresponds to "current" or "default" time for systems. It containsTime<Virtual>except inside theFixedMainschedule when it containsTime<Fixed>.The time elapsed since the previous time this clock was advanced is saved as
delta()and the total amount of time the clock has advanced is saved aselapsed(). Both are represented as exact [Duration] values with fixed nanosecond precision. The clock does not support time moving backwards, but it can be updated with [Duration::ZERO] which will setdelta()to zero.These values are also available in seconds as
f32viadelta_secs()andelapsed_secs(), and also in seconds asf64viadelta_secs_f64()andelapsed_secs_f64().Since
elapsed_secs()will grow constantly and isf32, it will exhibit gradual precision loss. For applications that require anf32value but suffer from gradual precision loss there iselapsed_secs_wrapped()available. The same wrapped value is also available as [Duration] andf64for consistency. The wrap period is by default 1 hour, and can be set byset_wrap_period().Accessing clocks
By default, any systems requiring current
delta()orelapsed()should useRes<Time>to access the default time configured for the program. By default, this refers toTime<Virtual>except during theFixedMainschedule when it refers toTime<Fixed>. This ensures your system can be used either inUpdateorFixedUpdateschedule depending on what is needed.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn ambivalent_system(time: Res<Time>) { println!("this how I see time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }If your system needs to react based on real time (wall clock time), like for user interfaces, it should use
Res<Time<Real>>. Thedelta()andelapsed()values will always correspond to real time and will not be affected by pause, time scaling or other tweaks.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn real_time_system(time: Res<Time<Real>>) { println!("this will always be real time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }If your system specifically needs to access fixed timestep clock, even when placed in
Updateschedule, you should useRes<Time<Fixed>>. Thedelta()andelapsed()values will correspond to the latest fixed timestep that has been run.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Fixed>>) { println!("this will always be the last executed fixed timestep: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }Finally, if your system specifically needs to know the current virtual game time, even if placed inside
FixedUpdate, for example to know if the game iswas_paused()or to useeffective_speed(), you can useRes<Time<Virtual>>. However, if the system is placed inFixedUpdate, extra care must be used because your system might be run multiple times with the samedelta()andelapsed()values as the virtual game time has not changed between the iterations.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Virtual>>) { println!("this will be virtual time for this update: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); println!("also the relative speed of the game is now {}", time.effective_speed()); }If you need to change the settings for any of the clocks, for example to
pause()the game, you should useResMut<Time<Virtual>>.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # #[derive(Event)] struct PauseEvent(bool); fn pause_system(mut time: ResMut<Time<Virtual>>, mut events: EventReader<PauseEvent>) { for ev in events.read() { if ev.0 { time.pause(); } else { time.unpause(); } } }Adding custom clocks
New custom clocks can be created by creating your own struct as a context and passing it to
new_with(). These clocks can be inserted as resources as normal and then accessed by systems. You can use theadvance_by()oradvance_to()methods to move the clock forwards based on your own logic.If you want to add methods for your time instance and they require access to both your context and the generic time part, it's probably simplest to add a custom trait for them and implement it for
Time<Custom>.Your context struct will need to implement the [
Default] trait because [Time] structures support reflection. It also makes initialization trivial by being able to callapp.init_resource::<Time<Custom>>().You can also replace the "generic"
Timeclock resource if the "default" time for your game should not be the default virtual time provided. You can get a "generic" snapshot of your clock by callingas_generic()and then overwrite the [Time] resource with it. The default systems added byTimePluginwill overwrite the [Time] clock duringFirstandFixedUpdateschedules.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # use bevy_platform::time::Instant; # #[derive(Debug)] struct Custom { last_external_time: Instant, } impl Default for Custom { fn default() -> Self { Self { last_external_time: Instant::now(), } } } trait CustomTime { fn update_from_external(&mut self, instant: Instant); } impl CustomTime for Time<Custom> { fn update_from_external(&mut self, instant: Instant) { let delta = instant - self.context().last_external_time; self.advance_by(delta); self.context_mut().last_external_time = instant; } }
Associated Functions
For function details and documentation, click on the function link.
Time<Virtual>
Time
- context:bevy_time::virt::Virtual
- wrap_period:core::time::Duration
- delta:core::time::Duration
- delta_secs:f32
- delta_secs_f64:f64
- elapsed:core::time::Duration
- elapsed_secs:f32
- elapsed_secs_f64:f64
- elapsed_wrapped:core::time::Duration
- elapsed_secs_wrapped:f32
- elapsed_secs_wrapped_f64:f64
Description
A generic clock resource that tracks how much it has advanced since its previous update and since its creation.
Multiple instances of this resource are inserted automatically by
TimePlugin:
Time<Real>tracks real wall-clock time elapsed.Time<Virtual>tracks virtual game time that may be paused or scaled.Time<Fixed>tracks fixed timesteps based on virtual time.- [
Time] is a generic clock that corresponds to "current" or "default" time for systems. It containsTime<Virtual>except inside theFixedMainschedule when it containsTime<Fixed>.The time elapsed since the previous time this clock was advanced is saved as
delta()and the total amount of time the clock has advanced is saved aselapsed(). Both are represented as exact [Duration] values with fixed nanosecond precision. The clock does not support time moving backwards, but it can be updated with [Duration::ZERO] which will setdelta()to zero.These values are also available in seconds as
f32viadelta_secs()andelapsed_secs(), and also in seconds asf64viadelta_secs_f64()andelapsed_secs_f64().Since
elapsed_secs()will grow constantly and isf32, it will exhibit gradual precision loss. For applications that require anf32value but suffer from gradual precision loss there iselapsed_secs_wrapped()available. The same wrapped value is also available as [Duration] andf64for consistency. The wrap period is by default 1 hour, and can be set byset_wrap_period().Accessing clocks
By default, any systems requiring current
delta()orelapsed()should useRes<Time>to access the default time configured for the program. By default, this refers toTime<Virtual>except during theFixedMainschedule when it refers toTime<Fixed>. This ensures your system can be used either inUpdateorFixedUpdateschedule depending on what is needed.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn ambivalent_system(time: Res<Time>) { println!("this how I see time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }If your system needs to react based on real time (wall clock time), like for user interfaces, it should use
Res<Time<Real>>. Thedelta()andelapsed()values will always correspond to real time and will not be affected by pause, time scaling or other tweaks.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn real_time_system(time: Res<Time<Real>>) { println!("this will always be real time: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }If your system specifically needs to access fixed timestep clock, even when placed in
Updateschedule, you should useRes<Time<Fixed>>. Thedelta()andelapsed()values will correspond to the latest fixed timestep that has been run.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Fixed>>) { println!("this will always be the last executed fixed timestep: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); }Finally, if your system specifically needs to know the current virtual game time, even if placed inside
FixedUpdate, for example to know if the game iswas_paused()or to useeffective_speed(), you can useRes<Time<Virtual>>. However, if the system is placed inFixedUpdate, extra care must be used because your system might be run multiple times with the samedelta()andelapsed()values as the virtual game time has not changed between the iterations.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # fn fixed_time_system(time: Res<Time<Virtual>>) { println!("this will be virtual time for this update: delta {:?}, elapsed {:?}", time.delta(), time.elapsed()); println!("also the relative speed of the game is now {}", time.effective_speed()); }If you need to change the settings for any of the clocks, for example to
pause()the game, you should useResMut<Time<Virtual>>.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # #[derive(Event)] struct PauseEvent(bool); fn pause_system(mut time: ResMut<Time<Virtual>>, mut events: EventReader<PauseEvent>) { for ev in events.read() { if ev.0 { time.pause(); } else { time.unpause(); } } }Adding custom clocks
New custom clocks can be created by creating your own struct as a context and passing it to
new_with(). These clocks can be inserted as resources as normal and then accessed by systems. You can use theadvance_by()oradvance_to()methods to move the clock forwards based on your own logic.If you want to add methods for your time instance and they require access to both your context and the generic time part, it's probably simplest to add a custom trait for them and implement it for
Time<Custom>.Your context struct will need to implement the [
Default] trait because [Time] structures support reflection. It also makes initialization trivial by being able to callapp.init_resource::<Time<Custom>>().You can also replace the "generic"
Timeclock resource if the "default" time for your game should not be the default virtual time provided. You can get a "generic" snapshot of your clock by callingas_generic()and then overwrite the [Time] resource with it. The default systems added byTimePluginwill overwrite the [Time] clock duringFirstandFixedUpdateschedules.# use bevy_ecs::prelude::*; # use bevy_time::prelude::*; # use bevy_platform::time::Instant; # #[derive(Debug)] struct Custom { last_external_time: Instant, } impl Default for Custom { fn default() -> Self { Self { last_external_time: Instant::now(), } } } trait CustomTime { fn update_from_external(&mut self, instant: Instant); } impl CustomTime for Time<Custom> { fn update_from_external(&mut self, instant: Instant) { let delta = instant - self.context().last_external_time; self.advance_by(delta); self.context_mut().last_external_time = instant; } }
Associated Functions
For function details and documentation, click on the function link.
Range
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Range
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
RangeInclusive
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<[u8; 6]>
None
Some
- [u8; 6]
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<String>
None
Some
- String
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<SpatialScale>
None
Some
- bevy_audio::audio::SpatialScale
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Color>
None
Some
- bevy_color::color::Color
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Entity>
None
Some
- bevy_ecs::entity::Entity
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<TextureAtlas>
None
Some
- bevy_image::texture_atlas::TextureAtlas
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<ForceTouch>
None
Some
- bevy_input::touch::ForceTouch
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<CompassOctant>
None
Some
- bevy_math::compass::CompassOctant
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Rect>
None
Some
- bevy_math::rects::rect::Rect
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<URect>
None
Some
- bevy_math::rects::urect::URect
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Indices>
None
Some
- bevy_mesh::index::Indices
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<ReflectReference>
None
Some
- ReflectReference
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<ScriptValue>
None
Some
- bevy_mod_scripting_core::bindings::script_value::ScriptValue
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Instant>
None
Some
- bevy_platform::time::Instant
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<SubCameraView>
None
Some
- bevy_render::camera::camera::SubCameraView
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Viewport>
None
Some
- bevy_render::camera::camera::Viewport
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<ReflectSchedule>
None
Some
- bevy_system_reflection::ReflectSchedule
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<ReflectSystem>
None
Some
- bevy_system_reflection::ReflectSystem
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<WindowTheme>
None
Some
- bevy_window::window::WindowTheme
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<bool>
None
Some
- bool
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<char>
None
Some
- char
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<NonZeroI16>
None
Some
- core::num::NonZeroI16
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<NonZeroU16>
None
Some
- core::num::NonZeroU16
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<NonZeroU32>
None
Some
- core::num::NonZeroU32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<f32>
None
Some
- f32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<f64>
None
Some
- f64
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<DVec2>
None
Some
- glam::DVec2
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Vec2>
None
Some
- glam::Vec2
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Vec3>
None
Some
- glam::Vec3
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<NodeIndex>
None
Some
- petgraph::graph::NodeIndex
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<SmolStr>
None
Some
- smol_str::SmolStr
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<u16>
None
Some
- u16
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<u32>
None
Some
- u32
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<usize>
None
Some
- usize
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
SmallVec<TypeId(0xc1d538f496361f974c57b26204ecc7b6)>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
SmallVec<TypeId(0x4b6461ca8cbe9c8a65662f182ea1e628)>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
SmallVec<TypeId(0x45830c46c5fe1d429cc9fa598a632c4a)>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
SmallVec<TypeId(0x1100952031e6e64f284e9a3b522b9e0d)>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
SmallVec<TypeId(0xc02b4f0291ef0aad60339b7367f351ef)>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<(bevy_ecs::entity::Entity, bevy_picking::backend::HitData)>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Vec<Range>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
EntityHashMap<Vec<Cascade>>
EntityHashMap
- bevy_platform::collections::HashMap<bevy_ecs::entity::Entity, alloc::vec::Vec<bevy_pbr::light::Cascade>, bevy_ecs::entity::hash::EntityHash>
Description
A [
HashMap] pre-configured to use [EntityHash] hashing.
Associated Functions
For function details and documentation, click on the function link.
HashSet<Entity>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashSet<GamepadButton>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<(u8, u8)>
None
Some
- (u8, u8)
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<(usize, usize)>
None
Some
- (usize, usize)
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Cow>
None
Some
- alloc::borrow::Cow
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Vec<String>>
None
Some
- alloc::vec::Vecalloc::string::String
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Handle<Image>>
None
Some
- bevy_asset::handle::Handle<bevy_image::image::Image>
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Handle<Mesh>>
None
Some
- bevy_asset::handle::Handle<bevy_mesh::mesh::Mesh>
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<(), InteropError>
Ok
- ()
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<String, InteropError>
Ok
- String
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Entity, InteropError>
Ok
- bevy_ecs::entity::Entity
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<DynamicFunctionMut, InteropError>
Ok
- DynamicFunctionMut
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptComponentRegistration, ScriptResourceRegistration>
Ok
- bevy_mod_scripting_core::bindings::query::ScriptComponentRegistration
Err
- bevy_mod_scripting_core::bindings::query::ScriptResourceRegistration
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptComponentRegistration, InteropError>
Ok
- bevy_mod_scripting_core::bindings::query::ScriptComponentRegistration
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptQueryBuilder, InteropError>
Ok
- bevy_mod_scripting_core::bindings::query::ScriptQueryBuilder
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ReflectReference, InteropError>
Ok
- ReflectReference
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptSystemBuilder, InteropError>
Ok
- bevy_mod_scripting_core::bindings::script_system::ScriptSystemBuilder
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptValue, InteropError>
Ok
- bevy_mod_scripting_core::bindings::script_value::ScriptValue
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptAttachment, InteropError>
Ok
- bevy_mod_scripting_core::script::context_key::ScriptAttachment
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ReflectSystem, InteropError>
Ok
- bevy_system_reflection::ReflectSystem
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<bool, InteropError>
Ok
- bool
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<AnimationTargetId, u64>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<GamepadAxis, AxisSettings>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<GamepadButton, ButtonAxisSettings>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<GamepadButton, ButtonSettings>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<GamepadInput, f32>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<NodeIndex, ActiveAnimation>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<NodeIndex, f32>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Vec<Entity>, InteropError>
Ok
- alloc::vec::Vec<bevy_ecs::entity::Entity>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Vec<ScriptQueryResult>, InteropError>
Ok
- alloc::vec::Vec<bevy_mod_scripting_core::bindings::query::ScriptQueryResult>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Vec<FunctionInfo>, InteropError>
Ok
- alloc::vec::Vec<bevy_mod_scripting_core::docgen::info::FunctionInfo>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Vec<ReflectSystem>, InteropError>
Ok
- alloc::vec::Vec<bevy_system_reflection::ReflectSystem>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<String>, InteropError>
Ok
- core::option::Optionalloc::string::String
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<Entity>, InteropError>
Ok
- core::option::Option<bevy_ecs::entity::Entity>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<ReflectReference>, InteropError>
Ok
- core::option::Option<bevy_mod_scripting_core::bindings::reference::ReflectReference>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<ScriptValue>, InteropError>
Ok
- core::option::Option<bevy_mod_scripting_core::bindings::script_value::ScriptValue>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<ReflectSchedule>, InteropError>
Ok
- core::option::Option<bevy_system_reflection::ReflectSchedule>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<ReflectSystem>, InteropError>
Ok
- core::option::Option<bevy_system_reflection::ReflectSystem>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<usize>, InteropError>
Ok
- core::option::Option
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
DiGraph
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<String, ScriptValue>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<AnimationEventTarget, Vec<TimedAnimationEvent>>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<AssetId<AnimationGraph>, ThreadedAnimationGraph>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
HashMap<Entity, Vec<Cascade>>
Opaque Type. 🔒
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<ScriptTypeRegistration, Result<ScriptComponentRegistration, ScriptResourceRegistration>>
Ok
- bevy_mod_scripting_core::bindings::query::ScriptTypeRegistration
Err
- core::result::Result<bevy_mod_scripting_core::bindings::query::ScriptComponentRegistration, bevy_mod_scripting_core::bindings::query::ScriptResourceRegistration>
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Option<Result<ScriptTypeRegistration, Result<ScriptComponentRegistration, ScriptResourceRegistration>>>
None
Some
- core::result::Result<bevy_mod_scripting_core::bindings::query::ScriptTypeRegistration, core::result::Result<bevy_mod_scripting_core::bindings::query::ScriptComponentRegistration, bevy_mod_scripting_core::bindings::query::ScriptResourceRegistration>>
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Result<Option<Result<ScriptTypeRegistration, Result<ScriptComponentRegistration, ScriptResourceRegistration>>>, InteropError>
Ok
- core::option::Option<core::result::Result<bevy_mod_scripting_core::bindings::query::ScriptTypeRegistration, core::result::Result<bevy_mod_scripting_core::bindings::query::ScriptComponentRegistration, bevy_mod_scripting_core::bindings::query::ScriptResourceRegistration>>>
Err
- bevy_mod_scripting_core::error::InteropError
Description
No Documentation 🚧
Associated Functions
For function details and documentation, click on the function link.
Core Callbacks
On top of callbacks which are registered by your application, BMS provides a set of core callbacks which are always available.
The three core callbacks are:
on_script_loadedon_script_unloadedon_script_reloaded
on_script_loaded
This will be called right after a script has been loaded or reloaded. This is a good place to initialize your script. You should avoid placing a lot of logic into the global body of your script, and instead put it into this callback. Otherwise errors in the initialization will fail the loading of the script.
This callback will not have access to the entity variable, as when the script is being loaded it's not attached to an entity yet.
print("you can also use this space, but it's not recommended")
function on_script_loaded()
print("Hello world")
end
on_script_unloaded
This will be called right before a script is unloaded. This is a good place to clean up any resources that your script has allocated. This is called both before a script is removed as well as before a script is reloaded. If you want to preserve the state of your script across reloads, you can return a value from this callback, which will be passed to on_script_reloaded when the script is reloaded.
This callback will not have access to the entity variable, as when the script is being unloaded it might not be attached to an entity.
function on_script_unloaded()
print("Goodbye world")
return "house key"
end
on_script_reloaded
Called right after on_script_loaded but only if the script was reloaded.
The callback is passed a state argument, this state is exactly what is returned by the script through on_script_unloaded before a reload happens.
This callback does not have access to the entity variable.
mode = 1
function on_script_reloaded(value)
if value then
print("I'm back. Thanks for the keys!")
else
print('I have not saved any state before unloading')
end
end
Using on_script_reloaded one can make a script reload preserve its current state.
Developing BMS
This section is for developers who want to contribute to the BMS project. It covers various topics necessary for understanding the project and contributing to it.
Contributing
Please see the code of conduct as well as the contributing guidelines first.
Setup
this crate contains a work in progress xtask setup which in theory should allow you to setup everything you need for local development by running:
cargo xtask init
This command currently supports the following IDE's
If you'd like to add support for another IDE, please feel free to open a PR!
Adding New Languages to BMS
If you are interested in adding a new language to BMS, please read this section first. Adding a new language is a non-trivial task depending on the language you want to add. It also requires a lot of effort and time to maintain a new language, so unless the language you want to add is widely used and has a large community, it might not be worth the effort.
Evaluating Feasibility
In order for a language to work well with BMS it's necessary it supports the following features:
- Interoperability with Rust. If you can't call it from Rust easilly and there is no existing crate that can do it for you, it's a no-go.
- First class functions. Or at least the ability to call an arbitrary function with an arbitrary number of arguments from a script. Without this feature, you would need to separately generate code for the bevy bindings which is painful and goes against the grain of BMS.
First Classs Functions
They don't necessarily have to be first class from the script POV, but they need to be first class from the POV of the host language. This means that the host language needs to be able to call a function with an arbitrary number of arguments.
Examples
Let's say your language supports a Value type which can be returned to the script. And it has a Value::Function variant. The type on the Rust side would look something like this:
pub enum Value {
Function(Arc<Fn(&[Value]) -> Value>),
// other variants
}
This is fine, and can be integrated with BMS. Since an Fn function can be a closure capturing a DynamicScriptFunction. If there is no support for FnMut closures though, you might face issues in the implementation. Iterators in bevy_mod_scripting_functions for example use DynamicScriptFunctionMut which cannot work with Fn closures.
Now let's imagine instead another language with a similar enum, supports this type instead:
#![allow(unused)] fn main() { pub enum Value { Function(Arc<dyn Function>), // other variants } pub trait Function { fn call(&self, args: Vec<Value>) -> Value; fn num_params() -> usize; } }
This implies that to call this function, you need to be able to know the amount of arguments it expects at COMPILE time. This is not compatibile with dynamic functions, and would require a lot of code generation to make work with BMS. Languages with no support for dynamic functions are not compatible with BMS.
Interoperability with Rust
Not all languages can easilly be called from Rust. Lua has a wonderful crate which works out the ffi and safety issues for us. But not all languages have this luxury. If you can't call it from Rust easilly and there is no existing crate that can do it for you, integrating with BMS might not be the best idea.
Necessary Features
In order for a language to be called "implemented" in BMS, it needs to support the following features:
- Every script function which is registered on a type's namespace must:
- Be callable on a
ReflectReferencerepresenting object of that type in the script
local my_reference = ... my_reference:my_Registered_function()- If it's static it must be callable from a global proxy object for that type, i.e.
MyType.my_static_function() - Be callable on a
ReflectReferencesmust support a set of basic features:- Access to fields via reflection i.e.:
local my_reference = ... my_reference.my_field = 5 print(my_reference.my_field)- Basic operators and standard operations are overloaded with the appropriate standard dynamic function registered:
- Addition: dispatches to the
addbinary function on the type - Multiplication: dispatches to the
mulbinary function on the type - Division: dispatches to the
divbinary function on the type - Subtraction: dispatches to the
subbinary function on the type - Modulo: dispatches to the
rembinary function on the type - Negation: dispatches to the
negunary function on the type - Exponentiation: dispatches to the
powbinary function on the type - Equality: dispatches to the
eqbinary function on the type - Less than: dispatches to the
ltbinary function on the type - Length: calls the
lenmethod onReflectReferenceor on the table if the value is one. - Iteration: dispatches to the
itermethod onReflectReferencewhich returns an iterator function, this can be repeatedly called until it returnsScriptValue::Unitto signal the end of the iteration. - Print: calls the
display_refmethod onReflectReferenceor on the table if the value is one.
- Addition: dispatches to the
- Script handlers, loaders etc. must be implemented such that the
ThreadWorldContaineris set for every interaction with script contexts, or anywhere else it might be needed.